Bug Tracker

Opened 11 years ago

Closed 11 years ago

#12898 closed bug (duplicate)

.on 4 with both selector and data parameters fails for multiple lines

Reported by: roderick.walsh@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


According to the documentation, this ought to work...

$(document).on("click", $('#clickerA'), {rnd: "hello"}, callbackFnAAA); $(document).on("click", $('#clickerB'), {rnd: "hello"}, callbackFnBBB);

...but instead the second line doesn't seem to be operative (#clickerB doesn't click), and the first line runs all callbacks (both AAA and BBB). The obvious fix that works is below - but surely that goes against the recommended practice for .on?...

$('#clickerA').on("click", {rnd: "hello"}, callbackFnAAAI); $('#clickerB').on("click", {rnd: "hello"}, callbackFnBBB);

...incidentally, I was using $(that.bi) and $(that.bi) for the selectors, where my var had already been defined...

be : $('#be'), bi : $('#bi'),

...but I guess that has nothing to do with the problem.

Right now I don't have code with all variations in there but the closest thing I have is: http://home.tamk.fi/~walrod/apps/webrtc/scripts/script2.js http://home.tamk.fi/~walrod/apps/webrtc/index2.html

Note, I has using 1.7.2 to find this bug, but a quick check shows that 1.8.3 also fails (though it seems a little differently).

I have my working fix and so I'm happy - but this bug flies in the face of the documents and numerous googlable items on .on(). I also didn't find any examples of $(document).on(type,selector,data,callback) using all 4 parameters, so maybe this is a known bug?

Change History (1)

comment:1 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #12897.

Note: See TracTickets for help on using tickets.