.bind enables you to pass variables into the callback function via the
e.data attribute in the event.

$(document).bind('click', {'foo': 'bar'}, function(e) {
   console.log(e.data.foo);
});

Can't do that with the .click shortcut.

Josh Powell

On Apr 6, 9:53 am, jQueryAddict <jqueryadd...@gmail.com> wrote:
> I want to do something based on the click event.  I was looking at
> examples and at the jQuery Docs.  Read them but so then a .blind() is
> adding an event handler where .click() is obviously an event handler
> but you could I guess use either or to handle for example a click
> event:
>
> .bind('click', function(){...
>
> or
>
> .click(function(){....
>
> right? either will work on whatever element you're working with
> right?  just 2 different ways of doing the same thing in jQuery I
> assume.

Reply via email to