Reputation: 6117
Please what is the difference between using jquery .bind() to attach an event to a selector and simply calling an event directly e.g .click() or .change()
Upvotes: 1
Views: 115
Reputation: 38147
There is no difference between
$().click(fn)
or $().change(fn)
and
$().bind('click',fn)
or $().bind('change',fn)
as in the background (jQuery source) the click
and change
methods use bind
Although as pointed out in this answer -> jQuery: $().click(fn) vs. $().bind('click',fn);
You can use bind for multiple events
Upvotes: 3
Reputation: 12068
actually .click() .change() etc' are just a shorthand for using .bind() with bind you could bind multiple events, custom events, etc
Upvotes: 1