well I have a question about the semantics, we can tie in a jQuery event to a node using .on ('event', fn), so I wonder if using for example: $node.on('click', fn) is more semantic and better than using $node.click (fn) ?
well I have a question about the semantics, we can tie in a jQuery
Share
Use .on is much better then using .click, or the old Event API. An explaination of jQuery itself: http://blog.jquery.com/2011/11/03/jquery-1-7-released/
If you have a list with 1000 list items and do a code like
Then each single list item gets this eventcallbackfunction.
But if you use
Now only the
<ul>gets the eventcallbackfunction, but if you click on the ul jQuery filters and see if you clicked on the li, if so you get the callback, if not you don’t get the callback.