Get Input Button Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button


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>

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

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

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

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


Related Tutorials