Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
validate .js
C#
obj = document.getElementById('txtstart');
   if (obj.value == "") {
       alert("Enter Start date");
       return false;
   }
   obj = document.getElementById('txtenddate');
   var on = document.getElementById('txtstart');
   var oob = document.getElementById('txtenddate').value;
   if (obj.value == "" && on.value <= oob.value) {
       alert("Enter correct date");
       return false;


but comparing two values can u guide where did wrong
Posted

1 solution

You need to convert the values of "on" and "oob" controls to javascript date object and then you can perform any logical check on them.

More info here[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900