I just found out that jQuery 1.7 introduced a new method, on(). With my brief study, I see it as a consolidated way to bind events, as opposed to decide which one of bind(), live(), and delegate() to use. IMO, this is a really nice addition that offers numerous benefits. But then I am not sure if I need to convert event shortcuts, such as click(). According to the official document, the definition of click() is still the shortcut to .bind('click', handler). I thought it would make more sense for the jQuery developers to redefine click() and other event shortcuts in v1.7+ to use on(), no?
I just found out that jQuery 1.7 introduced a new method, on() . With
Share
jQuery documentation is clearly presenting
.click()as a shorthand of.on("click"), so I guess you can replace all your previous calls, if you want.Extract of the
on()method documentation:The method
.on()actually does the same as.bind()except that you can bind multiple events at once, and select a set of children that actually fire this event.I don’t think it makes more sense to use
on()instead ofclick()unless you need to bind multiple events or do some more tricky stuff with filtering children.