<html>
<body>
<input value="OK">
<p>Click the button below to change the input field to an input button.</p>
<button onclick="myFunction()">Try it</button>
<p>Internet Explorer 8 and earlier does not support the setAttribute method.</p>
<script>
function myFunction() {
document.getElementsByTagName("INPUT")[0].setAttribute("type", "button");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_element_setattribute by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:02:20 GMT -->
</html>