Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14658 closed bug (duplicate)

Why does my event.originalEvent.detail get erased when I call trigger() on a checkbox?

Reported by: tieTYT Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0.3
Keywords: Cc:
Blocked by: Blocking:

Description

Here's a [JSFiddle example][1] showing my code:

    <input type="checkbox">

    $(":checkbox").on("click", function(event) {
        if (event.originalEvent.detail != 0) {
            alert("checkbox clicked");
        } else {
            alert("Not clicked");
        }
            
    });  
    
      e = jQuery.Event("click")
      e.originalEvent = {
          detail: 1
      }
      $(":checkbox").trigger(e)

In firefox, this will alert "Not Clicked". Shouldn't it alert "checkbox clicked" since I set detail = 1?

[1]: http://jsfiddle.net/WudVC/

Change History (1)

comment:1 Changed 6 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #13428.
This is basically a dup of #13428, caused by the fix for #3827. See the proposed workaround in #13428 of using .triggerHandler(), since you're processing this with your own code you can always follow the link via code if you need to and probably don't need the native click anyway.

Note: See TracTickets for help on using tickets.