Bug Tracker

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#202 closed enhancement (fixed)

Binding events with parameters

Reported by: Stefan Petre Owned by:
Priority: major Milestone: 1.1a
Component: event Version: 1.1a
Keywords: Cc:
Blocked by: Blocking:


I whould like you to bring to another level the bind() function so it can accept extra parameters to pass to called function something like:

bind(type, fn, [array parameters])

Change History (4)

comment:1 Changed 16 years ago by joern

Something like this?

clickHandler = function(event, params) {
  // do something with event and/or params
$("a").bind("click", clickHandler, [1, 2, 3]);

You could then also extend each event:

$("a").click(clickHandler, [1, 2, 3));

Would that be of any use?

comment:2 Changed 16 years ago by brandon.aaro

I've been spoiled by other libraries in this area and have enjoyed easily passing extra params to event handlers. This type of feature would be great.

comment:3 Changed 16 years ago by joern

Milestone: 1.1
Priority: minormajor
Version: 1.1

Check this for reference when implementing: http://jquery.offput.ca/event++/

comment:4 Changed 16 years ago by joern

Resolution: fixed
Status: newclosed

Fixed in SVN.

Note: See TracTickets for help on using tickets.