Get Input Button Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Introduction

The Input object represents an HTML <input> element with type='button'

You can access a <input type='button'> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button type="button" onclick="myFunction()">disable the BUTTON element</button>

<input type='button' id="myBtn" value='asdf'></button>

<p id="demo"></p>

<script>
function myFunction() {/*from  w ww.  jav a2  s.co  m*/
    var x = document.getElementById("myBtn");
    x.disabled = true;
}
</script>

</body>
</html>

Related Tutorials