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>The Element Object</h1> <h2>The setAttribute() Method</h2> <input id="myInput" value="OK"> <p>Click "Change" to change the input field to an input button.</p> <button onclick="myFunction()">Change</button> <script> function myFunction() { document.getElementById("myInput").setAttribute("type", "button"); } </script> </body> </html>