jQuery bind handler vs 'click' event
What would be the difference between setting up a click handler using .click() or binding the click handler:
- $('.cancelButton').click(function() {
- $('.dialog1').dialog('close');
- });
VS
- $('.cancelButton').bind('click', function(){
- $('.dialog1').dialog('close');
- });
Obviously they both do the same thing, but is one better (in terms of speed or practice) or does it not matter at all which one you use? I usually use .click() to avoid the extra typing but I want to make sure I'm not missing anything.