我想检查html代码运行函数中是否有类.required_selectbox
,html代码运行函数中required_selectbox()
是否有类,提交后,怎么样?.required
required_valid()
function required_valid() {
$('.required').each(function () {
if (!$(this).val()) {
//var cssObj=;
$(this).css("background", "#ffc4c4");
result = false;
} else {
$(this).css("background", "#FFFFEC");
result = true;
}
$(this).keyup(function () {
$(this).css("background", "#FFFFEC");
})
});
return result;
}
function required_selectbox() {
$('.required_selectbox').each(function () {
if (!$(this).val()) {
//var cssObj=;
$(this).css("background", "#ffc4c4");
result = false;
} else {
result = true;
}
});
return result;
}
$('.submit').submit(function () {
//alert('hello');
var passed = true;
passed = required_selectbox() && passed;
passed = required_valid() && passed;
if (!passed) {
return false;
}
});