I found two great articles talking about the new function .on()
: jquery4u.com, elijahmanor.com.
Is there any way where the .bind()
still is better to use than .on()
?
For example, I have a sample code that look like this:
$("#container").click( function( e ) {} )
You can note that I just have one item retrieved by the selector and in my case, the <div>
named #container
already exists when my page was loaded; not added dynamically. It’s important to mention that I use the latest version of jQuery: 1.7.2.
For that sample, should .on()
be used instead of .bind()
even if I don’t use the other features provided by the .on()
function?
.bind()
is bad for binding multiple elements, but fails to mention how.on()
when used in binding mode does exactly the same thing.