Quick Reach
jQuery keyup event
The keyup event is triggered after a key is released in the keyboard. The keyup() method will be used to perform any action or run a function as keyup event occurs in your web document.
Note that the keyup event returns same values for lowercase and uppercase letters, whereas keypress returns different for ‘a’ and ‘A’, for example.
Syntax of keyup event
Following is the general syntax of using the keyup jQuery method:
$(selector).keyup(function)
Where function is optional, to execute as keyup event occurs.
Running example of the keyup event
The example below shows when a key (from your keyboard) is released, and the keyup event occurs, the keyup() method will capture the event and throw an alert with ASCII value of the pressed key.
Experience this example online
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#keyboard").keyup(function(){
alert("keyup event occured! The Ascii value of pressed key is: " + event.keyCode);
});
});
</script>
</head>
<body>
Enter keyboard keys: <input type="text" id="keyboard">
</body>
</html>
|
Related : keydown() event | keypress() event
Leave A Comment?