HTML DOM Input Submit type Property


The HTML DOM Input Submit type property is associated with the input element having its type=”submit”. It will always return submit for the input submit element.

Syntax

Following is the syntax for submit type property −

submitObject.type

Example

Let us look at an example for the submit type property −

<!DOCTYPE html>
<html>
<body>
<h1>Input range type Property</h1>
<form>
VOLUME <input type="range" id="RANGE1" name="VOL">
</form>
<p>Get the above input element type by clicking the below button</p>
<button type="button" onclick="rangeType()">GET Type</button>
<p id="Sample"></p>
<script>
   function rangeType() {
      var P=document.getElementById("RANGE1").type;
      document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ;
   }
</script>
</body>
</html>

Output

This will produce the following output −

On clicking the “GET Type” button −

Updated on: 19-Feb-2021

68 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements