HTML oninput event Attribute
Example
<label for="myInput">Enter your first name:</label> <input type="text" id="myInput" oninput="myFunction()">
<p>You wrote: <output id="demo"></output></p>
<script>
function myFunction() {
var x = document.getElementById("myInput").value;
document.getElementById("demo").innerHTML = x;
}
</script>
Meaning
The oninput attribute fires when the value of an element is changed by the user.
Standard Syntax
<element oninput="script">
Browser Support
Status
Attribute Values
Value | Description |
---|---|
script | Specifies the script to be run on oninput |
Technical Details
Supported HTML elements:
<input type="password">, <input type="search">, <input type="text"> and <textarea>