I'm trying to compare 2 dates using Javascript. If "myDateL" is after "mydateR" display a message box when the button is clicked.
What is wrong with my code?
I know I've seen a similar thread to this but I couldn't understand it. I hope someone can help me with this please.
<input type="Button" value="TwoDates" onClick="twoDates()">
<script>
function twoDates() {
var firstdate = new date(document.getElementById("mydateL").value);
var seconddate = new date(document.getElementById("mydateR").value);
if(firstdate > seconddate) {
alert('Please change your return date.');
}
}
</script>