Input DatetimeLocal defaultValue Property - Get the default value of a datetime field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Datetime Local

Description

Input DatetimeLocal defaultValue Property - Get the default value of a datetime field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="datetime-local" id="myLocalDate" value="2018-11-16T15:25:33">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from   w  ww.  java2  s.com*/
    var x = document.getElementById("myLocalDate").defaultValue;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials