<!DOCTYPE html>
<html lang="en-US">
<body>
<input type="text" onkeypress="myFunction()">
<script>
function myFunction(){
alert("Your Keyboard key is down/pressed");
}
</script>
<p><strong>Note</strong> : Type something in the input element.</p> </body>
</html>