Wednesday, November 30, 2011

get modern with .bind

Why not do this?

$('#thingy').click(function () {

   whatever();

});

 
 

Why "get modern" and do this instead?

$('#thingy').bind('click', function () {

   whatever();

});

 
 

.click is a convenience method wrapping .bind('click', and there isn't always going to be a convenience method.

$('#thingy').bind('somethinguncommon', function () {

   whatever();

});

No comments:

Post a Comment