HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <input type="text" value="Change Me"> <p>Click on the button to toggle attribute between disabled and enabled</p> <button onclick="myFunction()">Toggle Button</button> <script> var elem = document.getElementsByTagName("input")[0]; function myFunction(){ elem.toggleAttribute("disabled"); } </script> </body> </html>
OUTPUT
×

Save as Private