HTML DOM Input Time defaultValue Property

The HTML DOM Input Time defaultValue property sets/returns the default value corresponding to Time Input. The value attribute changes as the user changes the time but default value does not change.


Following is the syntax −

  • Returning string value
  • Setting defaultValue to string
inputTimeObject.defaultValue = ‘string’


Let us see an example of Input Time defaultValue property −

 Live Demo

<!DOCTYPE html>
<title>Input Time defaultValue</title>
   form {
      margin: 0 auto;
      text-align: center;
   * {
      padding: 2px;
   input[type="button"] {
      border-radius: 10px;
<label for="TimeSelect">Meeting At:
<input type="time" id="TimeSelect" value="09:30">
<input type="button" onclick="changeMeet('Alternate')" value="Alternate Meeting Time">
<input type="button" onclick="changeMeet('Default')" value="Default Meeting Time"><br>
<input type="button" onclick="confirmMeet()" value="Confirm Meeting">
<div id="divDisplay"></div>
   var divDisplay = document.getElementById("divDisplay");
   var inputTime = document.getElementById("TimeSelect");
   function changeMeet(string) {
      if (inputTime.disabled === false) {
         if(string === 'Alternate')
            inputTime.value = '10:30';
            inputTime.value = inputTime.defaultValue;
   function confirmMeet() {
      inputTime.disabled = true;
      divDisplay.textContent = 'Meeting fixed at : '+inputTime.value;


This will produce the following output −

Before clicking ‘Alternate Meeting Time’ button −

Changing Time Input by clicking ‘Alternate Meeting Time’ button −

After clicking ‘Default Meeting Time’ button −

After clicking ‘Confirm Meeting’ button −