0
我想在這裏驗證時間是在數組中.with jQuery驗證插件和錯誤傳遞引導程序的popover()函數..但它顯示錯誤。使用@jquery驗證插件與引導程序插件的時間驗證..
Cannot read property 'settings' of undefined
這是我code.i要驗證在觸發blur事件......
$("input").blur(function() {
var check = $(this).closest('tr').find('input');
$.validator.addMethod(check, function(value, element) {
return this.optional(element) || /^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/i.test(value);
}, "please enter the valid time");
$(this).validate({
rules: {
'checkin[]': {
required: true
},
'checkout[]': {
rules: {
required: true
}
}
},
showErrors: function(errorMap, errorList) {
$.each(errorList, function(index, value) {
value.popover({
html: true,
trigger: 'blur',
content: function() {
return 'Empty Textbox';
}
});
});
$.each(this.successList, function(index, value) {
$(value).popover('hide');
var form_data = $(this).closest('tr').find('input').serialize();
$.ajax(
{
url: "<?php echo site_url("HomeController/calculate_time_lap"); ?>",
type: 'POST',
data: form_data,
success: function(result)
{
alert(result);
// $('input').closest('tr').find('.TextBox3').val(result);
}
});
return false;
});
}
});
});