Skip to main content

Bug Tracker

Side navigation

#14365 closed bug (notabug)

Opened September 16, 2013 03:24PM UTC

Closed September 16, 2013 08:03PM UTC

Last modified September 17, 2013 12:10PM UTC

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

Reported by: barney.carroll@gmail.com 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?

Attachments (0)
Change History (5)

Changed September 16, 2013 03:29PM UTC by barney.carroll@gmail.com comment:1

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

Changed September 16, 2013 08:03PM UTC by dmethvin comment:2

resolution: → notabug
status: newclosed

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

Changed September 16, 2013 08:36PM UTC by anonymous comment:3

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.

Changed September 16, 2013 08:54PM UTC by dmethvin comment:4

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

Changed September 17, 2013 12:10PM UTC by barney.carroll@gmail.com comment:5

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