Strange jQuery + jquery.validate + fullcalendar behaviour
I am not a jQuery expert and I need you guys to help me out here please. I have two text boxes that allows a user to enter a datetime stamp (using datetimepicker for it), but I need to make sure the end timestamp is greater than the start one. I am using the jquery validate plug-in with a custom method for it.
jQuery.validator.addMethod("startEndCheck", function(value, element, params) {
if (!/Invalid|NaN/.test(new Date(value))) {
return new Date(value) > new Date($(params).val());
}
return isNaN(value) && isNaN($(params).val()) || (parseFloat(value) > parseFloat($(params).val()));
},'Must be greater than start time.');
This how I am defining my datetimepicker:
$(document).ready(function() {
$('#start_time').datetimepicker({ ampm: true,timeFormat: 'hh:mm:ss' });
$('#end_time').datetimepicker({ ampm: true,timeFormat: 'hh:mm:ss' });
$('#ui-datepicker-div').wrap('<div class="cclicks"></div>');
$("#end_time").rules('add', { startEndCheck: "#start_time" });
});
I also have a fullcalendar jquery plug-in added to the same page. As soon as I add the
$("#end_time").rules('add', { startEndChe开发者_StackOverflowck: "#start_time" });
My fullcalendar vanishes away. I am not sure how to trouble shoot this.
Issue has been resolved by upgrading the plugins to the latest and greatest along with the latest jquery lib.
Thank you all for your help.
Nikkee
精彩评论