我是一個新手到javascript,我不能返回該函數的布爾值..我驗證文本框爲null,並返回false,如果它的空幫助請?jquery錯誤與返回布爾值
validateForm : function() {
$('.requiredField :input').each(function(){
if ('input[type=text]'){
if($(this).val().length === 0){
$(this).addClass('warning');
var errorMsg = $('<br /><span>Please Fill in the TextBox</span>').addClass('warning');
errorMsg.insertAfter(this);
$(errorMsg).css('color','red');
$('.warning').css('border-color','red');
//$(this).focus(function(){
//$(this).removeClass('warning');
//$(this).parent().children('span').remove();
//$(this).parent().children('br').remove();
//});
return false;
}
else
return true;
}
});
},
Form.validateForm(); // call to the function
你得到一個錯誤信息? – Kaf 2013-03-04 17:46:56
@Kaf沒有消息或沒有錯誤 – inputError 2013-03-04 17:47:59
返回false到哪裏?你只是在執行這個函數。 – Popnoodles 2013-03-04 17:48:20