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 −
Property | Description |
---|---|
autofocus | To set or return if the submit button should get focus automatically when the page loads or not. |
defaultValue | To set or return the submit button default value. |
disabled | To set or return if the submit button has been disabled, or not. |
form | To return the reference of the form containing the submit button. |
formAction | To set to return the formaction attribute value of a submit button. |
formEnctype | To set or return the formenctype attribute value of a submit button |
formMethod | To set or return the formmethod attribute value of a submit button |
formNoValidate | To set or return if the form data should be validated or not on being submitted. |
formTarget | To set or return the formtarget attribute value of a submit button. |
name | To set or return the name attribute value of the submit button. |
type | To return the form element type for the submit button. |
value | To 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 −
<!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 −