From the bind() jQuery API:
As of jQuery 1.7, the .on() method is the preferred method for
attaching event handlers to a document.
And from the change() jQuery API:
This method is a shortcut for .bind(‘change’, handler).
But there’s no mention that change() is not to be used as it says in the bind() one.
Is there any real benefit from using on() instead of bind() as of jQuery 1.7? Are change() and similar shortcuts using bind() or on() as of jQuery 1.7? Ultimately, should I use change() or on()?
Thanks in advance.
The shortcut methods (e.g.
.change()) simply callbindinternally:And
bindsimply callson:So it’s probably very marginally quicker to just call
onyourself. In real terms, there will be no difference in speed, so just use the one you feel most comfortable with.