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 keyup Event</h2> <p>Use the HTML DOM to assign an "onkeyup" event to an input element.</p> <p>A function is triggered when the user releases a key in the input field.</p> <p>The function transforms the input field to upper case:</p> Enter your name: <input type="text" id="fname"> <script> document.getElementById("fname").onkeyup = function() {myFunction()}; function myFunction() { let x = document.getElementById("fname"); x.value = x.value.toUpperCase(); } </script> </body> </html>