为什么会出现这种失败...jQuery的:如何找到元素* *没有某一类
$('div.contactAperson input').not('input.hadFocus').focus(function() {
$(this).attr('value', '');
});
...它的意思嗅出输入的有没有得到了类.hadFocus然后当其中一个子集接收到焦点时,它应该将值变为null。
现在,输入值总是变为zapped - 测试.not('input.hadFocus')无法停止执行。
顺便说一句,上面的代码前面的是下面的代码,这是工作的罚款:
$('div.contactAperson input').focus(function() {
$(this).addClass('hadFocus');
});
感谢任何聪明 - 欢呼声,-Alan
重复的:我怎么能不选择在jQuery的一个给定类的所有元素?(http://stackoverflow.com/questions/2448051) – hippietrail 2012-12-02 02:46:04