HTML DOM Input Time name Property

The HTML DOM Input Time name property returns a string, which displays the value of the name attribute of input Time. 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 Time name property −

 Live Demo

<!DOCTYPE html>
<title>Input Time name</title>
   form {
      margin: 0 auto;
      text-align: center;
   * {
      padding: 2px;
   input[type="button"] {
      border-radius: 10px;
<label for="TimeSelect">Appointment at Stephan:</label>
<input type="time" name="Stephan" id="TimeSelect" value="18:00">

<input type="button" onclick="changeMeeting()" value="Confirm">
<input type="button" onclick="changeName()" value="Book at Dorcel's">
<div id="divDisplay"></div>
   var labelDisplay = document.getElementsByTagName("label")[0];
   var divDisplay = document.getElementById("divDisplay");
   var inputTime = document.getElementById("TimeSelect");
   function changeMeeting() {
      if( === 'Stephan')
            divDisplay.textContent = 'Stephan Hospital is closed today';
         divDisplay.textContent = 'Appointment at Dorcel Hospital fixed at: '+inputTime.value;
   function changeName(){ = 'Dorcel';
      labelDisplay.textContent = 'Appointment at '': ';


This will produce the following output −

After clicking ‘Confirm’ button −

After clicking ‘Book at Dorcel’s’ button −

After clicking ‘Confirm’ button with name attribute set to another name −