How to use JQuery Event which Property

This article describe about jQuery Event which Property.
  • 2096

jQuery Event which Property

It is specifies that which key or button was pressed for the event by the which property.

And which property can be applied on key and button events.

Syntax

event.which

 

Parameter Description
event Required. It is define the event to check. event parameter comes from event binding method

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        $("input").keydown(function (event) {

            $("div").html("Key: " + event.which);

        });

    });

</script>

</head>

<body>

 

Enter name: <input type="text" />

<p>When you type your name in the field, the div below will display the key number.</p>

<div />

 

</body>

</html>

 

 

Output


which property pic29.jpg


Note: If you enter your name in field box, then below show the key value or ASCII value.


which property pic30.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.