Submit typeProperty
Submit Object
Definition and Usage
The type property returns the form element type of the submit button.
For a submit button, this property is always "submit".
Syntax
submitObject.type
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the type property.
Example
Example
The following example returns the form element type of the submit button:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("submit1").type;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="submit" id="submit1">
</form>
<button type="button" onclick="displayResult()">Display input type</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Rookie Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("submit1").type;
alert(x);
}
</script>
</head>
<body>
<form>
Email: <input type="text" id="email">
<input type="submit" id="submit1">
</form>
<button type="button" onclick="displayResult()">Display input type</button>
</body>
</html>
Try it yourself »
Submit Object Other Extensions