The confusion is to do a date validation in HTML. Is it necessary that the input type has to be "Date". Or can do the validation as input type is "text"?
I tried following JavaScript to alert user when one date is eariler than another.
The input field for these values type were set as "text".
Is there another way to do while type is "text" or do i have to change the type?
function checkDate(){
var date1=new Date();
var date2=new Date();
date1=$("#txtStartDate").val();
date2=$("#txtCloseDate").val();
if(date1<date2){
alert("The End date can't be earlier than the Start date !!");
}
}
And I am calling this function onChange
event at date 2 input.
From the debugger the function is calling but it's not validating.