Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14365 closed bug (notabug)

event.which passed to 'click' event is always 0 in IE8

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

According to the documentation, event.which:

event.which also normalizes button presses (mousedown and mouseupevents), reporting 1 for left button, 2 for middle, and 3 for right. Use event.which instead of event.button.

And yet I can't get jQuery 1.10.1 to return anything other than 0. Am I missing a trick?

Change History (5)

comment:1 Changed 10 years ago by [email protected]

I say "1.10.1", but it applies to 1.10.2 back to 1.8.3.

comment:2 Changed 10 years ago by dmethvin

Resolution: notabug
Status: newclosed

You quoted the docs yourself. The click event doesn't pass through the button information but mousedown/up does.

comment:3 Changed 10 years ago by anonymous

You're absolutely right, but is there a way I could petition for such information to be passed on to the click event? It really does seem pertinent.

comment:4 Changed 10 years ago by dmethvin

The IE8 browser doesn't pass it to jQuery on a click event. If you need the info you could handle mousedown/up instead.

comment:5 Changed 10 years ago by [email protected]

Thanks for the clarification.

For posterity (ie other people with my same problem coming across this), I'd like to take the opportunity to link a plugin I wrote to create leftclick, rightclick, middleclick and anyclick events which fire in the same circumstances as click and can preventDefault for the ensuing events, but which keep event.which.

jquery.whichclick.js

Note: See TracTickets for help on using tickets.