Input Datetime max Property - Change the maximum date and time: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Datetime

Description

Input Datetime max Property - Change the maximum date and time:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Date and time:/*from   w ww.  java2s  .  c  om*/
<input type="datetime" id="myDatetime" min="2000-01-01T22:57Z" max="2018-02-06T22:57Z">

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

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

<script>
function myFunction() {
    var x = document.getElementById("myDatetime").max = "2012-01-01T11:57Z";
    document.getElementById("demo").innerHTML = "changed from '2018-02-06T22:57Z' to '2012-01-01T11:57Z'.";
}
</script>
</body>
</html>

Related Tutorials