Skip to main content

Bug Tracker

Side navigation

#12898 closed bug (duplicate)

Opened November 15, 2012 07:16AM UTC

Closed November 15, 2012 02:12PM UTC

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

Reported by: 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 $( and $( 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:

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?

Attachments (0)
Change History (1)

Changed November 15, 2012 02:12PM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Duplicate of #12897.