我是一个新手到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