3

I have a jsfiddle here - http://jsfiddle.net/pYy5Q/ - where rolling over a box without the left mouse button held down displays e.which = 1 when using Firefox. Chrome works as I expect, with e.which = 1 if the left mouse button is down and e.which = 0 if not.

Does anyone understand what's going on?

$(function() {
    $('#box').mousemove(function(e) {
        console.log("e.which is " + e.which);
    });
});
Michael Liu
  • 52,147
  • 13
  • 117
  • 150
Steve
  • 4,534
  • 9
  • 52
  • 110

1 Answers1

2

e.which is the value you have entered.

For keystroke, it's the character code. e.g), e.which for enter is 13.

For mouse click, it's the button you are clicking. When you click right button, you will get a value other than 0, 1. I get 3 because it's the third button on my mouse.

David W Lee
  • 169
  • 3