Javascript examples for DOM HTML Element:Button
The Input Button object represents an HTML <button> element.
You can access an <button> element by using getElementById():
<!DOCTYPE html> <html> <body> <button id="myBtn" onclick="myFunction()" value="get the text that on the button">test</button> <p id="demo"></p> <script> function myFunction() {// w w w .ja v a 2 s .co m var x = document.getElementById("myBtn").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>