为什么即使它们都是正确的,这两个 if 语句也不通读?
HTML
<textarea name="test">
Focus out to test prompts
</textarea>
jQuery
var disableA = 1;
var disableB = 1;
$('textarea[name="test"]').focusout(function() {
if (disableA == 1) {
disableX();
}
if (disableB == 1) {
disableY();
}
});
function disableX() {
alert('A is disabled');
}
function disabledY() {
alert('B is disabled');
}
现在它会要求disableX();
但不是disableY()
jsFiddle:http: //jsfiddle.net/nCQQm/