Input Submit type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Description

The type property returns the type of form submit button.

For a submit button object, this property will always return "submit".

Return Value

Type Description
String The type of form element the submit button is

The following code shows how to check which type of form element the Submit button is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="submit" id="mySubmit">

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//ww w . j  a va  2s.  c  o m
    var x = document.getElementById("mySubmit").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials