Return the text displayed on a Submit button:
var x = document.getElementById("mySubmit").value;
Click the button to display the text displayed on the Submit button.
<!DOCTYPE html> <html> <body> <input type="submit" id="mySubmit" value="Submit form"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w. ja va 2 s .c o m var x = document.getElementById("mySubmit").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>