Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1>HTML DOM Events</h1> <h2>The oninput Event</h2> <p>Write something in the text field to trigger a function.</p> <input type="text" id="myInput" oninput="myFunction()"> <p id="demo"></p> <script> function myFunction() { let text = document.getElementById("myInput").value; document.getElementById("demo").innerHTML = "You wrote: " + text; } </script> </body> </html>