0
當它應該返回true或false時,isUpdatable方法返回undefined。 這是一個範圍問題。當我在isUpdatable方法上進行登錄時,我發現它輸出true和false,但是keyup函數返回undefined。不返回布爾值的函數
$(function() {
var updatableEl = ['home', 'block', 'cat'];
inputFields.keyup(function(){
var $input = $(this);
console.log("isUpdatable= ", isUpdatable($input));
});
function isUpdatable(el){
$.each(updatableEl, function(intIndex, objValue){
//console.log(" objValue = ", el.hasClass(objValue));
return el.hasClass(objValue);
});
}
});