以前のstackoverflowの質問によると、これが私のjqueryコードです
$('#productId').validate({
rules: {
product: {
required: true,
term: {regex: /^$|\s/}
}
},
messages: {
product: {
required: "A text is much",
term: "Please avoid spaces"
},
},
showErrors: function (errorMap, errorList) {
$.each(this.successList, function (index, value) {
$('#'+value.id+'').popover('destroy');
});
$.each(errorList, function (index, value) {
$('#'+value.element.id+'').attr('data-content',value.message, 'title', 'Oops!').popover({
placement: 'top',
trigger: 'manual',
delay: { show: 500, hide: 5000 }
}).popover('show');
});
}
});
私がやろうとしているのは、入力された用語に空白がある場合にポップオーバーを表示することです。しかし、それは私にエラーを与えるたびに
Uncaught TypeError: Cannot call method 'call' of undefined
正規表現の部分に問題があることはわかっています。minLength で同じコードを試してみたところ、うまくいきました。私は何を間違っていますか?
PSポップオーバーにTwitterブートストラップを使用しています。
更新: エラーの詳細
Uncaught TypeError: Cannot call method 'call' of undefined ----------jquery.validate.js:504
$.extend.check ---------- jquery.validate.js:504
$.extend.element ---------- jquery.validate.js:357
$.extend.defaults.onfocusout ---------- jquery.validate.js:231
delegate ---------- jquery.validate.js:317
(anonymous function) ---------- jquery.validate.js:1184
jQuery.event.dispatch ---------- jquery.js:3075
elemData.handle ---------- jquery.js:2751
jQuery.event.trigger ---------- jquery.js:2987
jQuery.event.simulate ---------- jquery.js:3302
handler