Get which was press in key up event handler - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:keyup

Description

Get which was press in key up event handler

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("input").keyup(function(event){
        $("div").html("Key: " + event.which);
    });/*from   ww w.  ja  va 2 s .  c om*/
});
</script>
</head>
<body>

<p>type in the field.</p>

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

<div />

</body>
</html>

Related Tutorials