Javascript DOM oninput Event via HTML Tag oninput attribute

Introduction

This example demonstrates how to assign an "oninput" event to an input element.

Write something in the text field to trigger a function.

<!DOCTYPE html>/*from w  ww .  ja v a2 s.  c  om*/
<html>
<body>
Enter name: <input type="text" value="Mickey" oninput="myFunction()">
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "The value of the input field was changed.";
}
</script>

</body>
</html>
MultiLlineTable:
Bubbles:                 Yes
Cancelable:              No
Event type:              Event, InputEvent
Supported HTML tags:     <input type="color">, 
                         <input type="date">, 
                         <input type="datetime">,
                         <input type="email">, 
                         <input type="month">, 
                         <input type="number">, 
                         <input type="password">, 
                         <input type="range">, 
                         <input type="search">, 
                         <input type="tel">, 
                         <input type="text">, 
                         <input type="time">, 
                         <input type="url">, 
                         <input type="week"> and 
                         <textarea>



PreviousNext

Related