1
Well, I have the following javascript code:
< script type = "text/javascript" >
function teste() {
var date1 = document.getElementById("data");
var date2 = document.getElementById("data2");
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
alert(diffDays);
} < /script>
In html I have the following code:
Reserve of: <input type="date" name="data" id="data" />
Up until: <input type="date" name="data2" id="data" onblur="teste()" />
I would like to know why I next put the date in the inputs does not appear a alert
saying the number of days.
Solved, thank you very much!
– Gonçalo