The Input Submit object in HTML DOM represents the HTML <input> element with type = “submit” attribute.
Syntax:
- It creates an Input Submit Object.
document.createElement("INPUT")
- It is used to access an Input Submit Object.
document.getElementById("id")
Property Values:
- autofocus: It sets or returns whether a submit button should automatically get focus when the page loads or not.
- defaultValue: It sets or returns the default value of the submit button.
- disabled: It sets or returns whether the submit button is disabled or not.
- form: It returns a reference to the form that contains the submit button.
- formAction: It sets or returns the value of the formAction attribute of the submit button.
- formEnctype: It sets or returns the value of the formEnctype attribute of the submit button.
- formMethod: It sets or returns the value of the formMethod attribute of the submit button.
- formNoValidate: It sets or returns whether the submit button, allows the form-data to be validated or not.
- formTarget: It sets or returns the value of the formTarget attribute of the submit button.
- name: It sets or returns the value of the name attribute of the submit button.
- type: It returns the form element type of the submit button.
- value: It sets or returns the value of the value attribute of the submit button.
Return Value: It returns the object, corresponding to the input submit action performed.
Example 1: This example creates an Input Submit Object
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML DOM Input Submit Object
</ title >
</ head >
< body >
< h2 >
HTML DOM Input Submit Object
</ h2 >
< p >
Click on the button to create
submit button
</ p >
< button onclick = "myGeeks()">
Click Here!
</ button >
< script >
function myGeeks() {
var btn = document.createElement("INPUT");
btn.setAttribute("type", "submit");
btn.value = ("Submit @ geeksforgeeks");
document.body.appendChild(btn);
}
</ script >
</ body >
</ html >
|
Output:
Before click on the button:
After click on the button:
Example 2: This example describes the access of an Input Submit Object
HTML
<!DOCTYPE html>
< html >
< head >
< title >
HTML DOM Input Submit Object
</ title >
</ head >
< body >
< h2 >
HTML DOM Input Submit Object
</ h2 >
< p >
Click on the button to create
submit button
</ p >
< input type = "submit" id = "Geeks"
value = "Submit @ geeksforgeeks">
< button onclick = "myGeeks()">
Click Here!
</ button >
< p id = "GFG"></ p >
< script >
function myGeeks() {
var btn = document.getElementById("Geeks").value;
document.getElementById("GFG").innerHTML = btn;
}
</ script >
</ body >
</ html >
|
Output:
Before click on the button:
After click on the button:
Supported Browsers: The browser supported by DOM Input Submit Object are listed below:
- Google Chrome 1 and above
- Firefox 1 and above
- Edge 12 and above
- Opera
- Safari 1 and above
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
26 Aug, 2022
Like Article
Save Article