HTML DOM Input Date name Property

The HTML DOM Input Date name property returns a string, which is the name attribute of input date. User can also set it to a new string.


Following is the syntax −

  • Returning string value
  • Setting name attribute to a string value = ‘String’


Let us see an example of Input Date name property −

 Live Demo

<!DOCTYPE html>
<title>Input Date Name</title>
Date Select: <input type="date" id="date" name="Monday">
<button onclick="changeNameValue()">Change name value</button>
<div id="divDisplay"></div>
   var inputDate = document.getElementById("date");
   var divDisplay = document.getElementById("divDisplay");
   divDisplay.textContent = 'Name of date input: ';
   function changeNameValue() {
      if( == 'Monday'){ = 'Tuesday';
         divDisplay.textContent = 'Name of date input: ';


This will produce the following output −

Before clicking ‘Change name value’ button −

After clicking ‘Change Name Value’ button −