event.whichS2C Home « Objects « event.which

Event description property.

Description

The event.which Event object property, contains the value of the description of the event.

Syntax


Signature Description
event.whichA value indicating the key or button that was pressed for keyboard and mouse events..

Parameters

None.

Return

A Number object.

event.which Examplego to top of page Top

Contains a value indicating the key or button that was pressed for keyboard and mouse events.

When we click the mouse button in the div below with an id of 'div7' a message is output.



$(function(){
  $('#div7').on('click', function(event) {
    if ( event.which == 1 ) {
       $('#div7').append('You pressed the left mouse button.
'); } }); });

div7. Some initial text.



go to home page Homepage go to top of page Top