Javascript Reference - HTML DOM Input Submit type Property








The type property gets type string of a submit button.

Browser Support

type Yes Yes Yes Yes Yes

Syntax

var v = submitObject.type 

Return Value

A String type value representing the type of the submit button





Example

The following code shows how to get the type of the Submit button.


<!DOCTYPE html>
<html>
<body>
<input type="submit" id="mySubmit">
<button onclick="myFunction()">test</button>
<!--from   w w  w  .j  a v a2s  .c  o m-->
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("mySubmit").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: