oninput = myFunction(); - Javascript DOM Event

Javascript examples for DOM Event:Element Event Attribute

Description

The oninput event occurs when an element gets user input.

Summary

Bubbles Yes
Cancelable No
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>

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Enter name: <input type="text" id="myInput" value="Mickey">

<script>
document.getElementById("myInput").oninput = function() {myFunction()};

function myFunction() {/*from   ww w  . j a v a2s.c  om*/
    console.log("The value of the input field was changed.");
}
</script>

</body>
</html>

Related Tutorials