开发者

Add handler multiple times in jquery

开发者 https://www.devze.com 2022-12-26 09:13 出处:网络
How does jquery handle event assign开发者_如何学编程ment when it comes to assigning the same handler multiple times?Let\'s say I have

How does jquery handle event assign开发者_如何学编程ment when it comes to assigning the same handler multiple times? Let's say I have

<div class="draggable">Some Text</div>

Are there any side effects (performance or otherwise) from calling the following multiple times?

$('.draggable').draggable();


If you bind a event like 'keydown' multiple times to an element, it will get attached to a queue of event handlers. So you can do the math, the more handlers are called, the slower it will perform.

0

精彩评论

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