Skip to main content

Bug Tracker

Side navigation

#14658 closed bug (duplicate)

Opened December 31, 2013 03:33AM UTC

Closed January 04, 2014 08:14PM UTC

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/

Attachments (0)
Change History (1)

Changed January 04, 2014 08:14PM UTC by dmethvin comment:1

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.