Get Input Submit Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Introduction

The Input Submit object represents an HTML <input> element with type="submit".

You can access an <input> element with type="submit" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="submit" id="mySubmit" value="Submit the form">

<button onclick="myFunction()">get the text displayed on the submit button</button>

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

<script>
function myFunction() {/* w w w .j a va  2s.  com*/
    var x = document.getElementById("mySubmit").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials