/

HTML / CSS / JavaScript Tutorial

HTML Event attribute: oninput

[this page | pdf | back links]

The HTML oninput attribute specifies the event that is triggered when an element gets user input. It applies to all visible elements.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
oninput: try entering text into this input field
<input type="text" id="inputtext" oninput="myOninput()">
<br><br><b id="inputtedtext"></b><br>

<script>
function myOninput() {
  document.getElementById("inputtedtext").innerHTML =
    document.getElementById("inputtext").value;}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile