开发者

Is this a jquery.live() side effect?

I'm new to jq开发者_运维知识库uery. When I was using .live('click', handler) instead of .click(handler), I found the event handler can be triggered even though the object is disabled! Is this a bug of .live() all it is an anticipated behavior? And if do not want the side effect, what should I do? Thanks!


Looks like a bug.


As an alternative/workaround, use this instead:

$('#myForm').delegate('#myButton', 'click', handler);

Here's a fiddle showing that this does produce the desired results: http://www.jsfiddle.net/YcS8A/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜