HTML DOM Input Submit name property

HTMLWeb DevelopmentFront End Technology

The HTML DOM Input Submit name property is used for setting or returning the name attribute of a submit button. The name attribute helps in identifying the form data after it has been submitted to the server.


Following is the syntax for −

Setting the name property − = name

Here, name is for specifying the submit button name.


Let us look at an example for the Submit name property −

Live Demo

<!DOCTYPE html>
<h1>Input submit name Property</h1>
<form style="border:solid 2px green;padding:2px">
UserName: <input type="text" id="USR"> <br>
Location: <input type="text" id="Loc"> <br><br>
<input type="submit" id="SUBMIT1" name="BTN1">
<p>Change the name of the above submit button by clicking the below button</p>
<button type="button" onclick="changeName()">CHANGE NAME</button>
<p id="Sample"></p>
   function changeName() {
      document.getElementById("SUBMIT1").name ="SUB_BTN" ;
      document.getElementById("Sample").innerHTML = "Submit Button name is now SUB_BTN";


This will produce the following output −

On clicking the CHANGE NAME button −

Updated on 19-Feb-2021 05:49:16