Javascript examples for DOM HTML Element:Input Button
The type property returns the type of form element.
For an input button this property always returns "button".
A String, representing the type of form element
The following code shows how to return type of form element:
<!DOCTYPE html> <html> <body> <input type="button" onclick="myFunction()" id="myBtn" value="Test"> <p id="demo"></p> <script> function myFunction() {/* w ww . j av a 2s .co m*/ var x = document.getElementById("myBtn").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>