|
Definition and UsageThe onkeydown attribute fires when the user is pressing a key (on the keyboard). Tip: The order of events related to the onkeydown event:
Applies toThe onkeydown attribute is part of the Event Attributes, and can be used on any HTML elements.
Browser Support
|
<!DOCTYPE html>
<html>
<body>
<p>A function is triggered when the user is pressing a key in the input field.</p>
<input type="text" onkeydown="myFunction()">
<script>
function myFunction() {
alert("You pressed a key inside the input field");
}
</script>
</body>
</html>
| html onkeydown attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Read Articlehttps://develop.horje.com/learn/1434/reference