searchsanjaysharma
asked on
How to compare two textboxes in jquery.
t1 and t2 are two be compared.
The type of values in t1 and t2 are dates.
t2 should be greater then t1
The type of values in t1 and t2 are dates.
t2 should be greater then t1
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are also using jQuery ui, in particular datepicker, you can use $.datepicker.parseDate(for mat, string) to turn your date strings into a JavaScript Date object, which you can then compare using the standard < and >
ASKER
<script type="text/javascript">
$(document).ready(function () {
$.validator.addMethod("txt tdate", function (value, element) {
var startDate = $('.txtfdate').val();
return Date.parse(startDate) <= Date.parse(value) || value == "";
}, "* End date must be after start date");
$('#form1').validate();
});
</script>
Not working
$(document).ready(function
$.validator.addMethod("txt
var startDate = $('.txtfdate').val();
return Date.parse(startDate) <= Date.parse(value) || value == "";
}, "* End date must be after start date");
$('#form1').validate();
});
</script>
Not working
ASKER
ok