Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <script> function myFunction() { document.getElementById("demo").innerHTML = "You selected some text"; } </script> </head> <body> <h1>JavaScript HTML Events</h1> <h2>The onselect Attribute</h2> Some text: <input type="text" value="Hello world!" onselect="myFunction()"> <p id="demo"></p> </body> </html>