Add handler multiple times in jquery
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.
精彩评论