HTML DOM Input Submit object property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Input Submit object is associated with the <input> element with type “submit”. We can create and access an input element with type submit by using the createElement() method and getElementById() method respectively.

Properties

Following are the properties for the Input submit object −

PropertyDescription
autofocusTo set or return if the submit button should get focus automatically when the page loads or not.
defaultValueTo set or return the submit button default value.
disabledTo set or return if the submit button has been disabled, or not.
formTo return the reference of the form containing the submit button.
formActionTo set to return the formaction attribute value of a submit button.
formEnctypeTo set or return the formenctype attribute value of a submit button
formMethodTo set or return the formmethod attribute value of a submit button
formNoValidateTo set or return if the form data should be validated or not on being submitted.
formTargetTo set or return the formtarget attribute value of a submit button.
nameTo set or return the name attribute value of the submit button.
typeTo return the form element type for the submit button.
valueTo set or return the value attribute value of a submit button.

Syntax

Following is the syntax for −

Creating an input submit object −

var P = document.createElement("INPUT");
P.setAttribute("type", "submit");

Example

Let us look at an example for the Input submit object property −

Live Demo

<!DOCTYPE html>
<html>
<head>
<script>
   function rangeCreate() {
      var S = document.createElement("INPUT");
      S.setAttribute("type", "submit");
      document.body.appendChild(S);
   }
</script>
</head>
<body>
<h1>Input submit object</h1>
<p>Create an input submit button by clicking the below button</p>
<button onclick="rangeCreate()">CREATE</button>
<br><br>
</body>
</html>

Output

This will produce the following output −

On clicking the CREATE button −

raja
Published on 19-Aug-2019 14:59:06
Advertisements