$(document).ready(function () {
$(".add").click(function () {
$(":text").each(function () {
if (this.val == "") {
alert("请完整填写!");
return false;
}
});
});
});
请教这段代码哪里出错了??
$(".add").click(function () {
$(":text").each(function () {
if (this.val == "") {
alert("请完整填写!");
return false;
}
});
});
});
请教这段代码哪里出错了??
$(".add").click(function () {
$(":text").each(function () {
if (this.value == "") {
alert("请完整填写!");
return false;
}
});
});
});
if (this.value == "") 或者
if ($(this).val() == "")
if (this.value == "") 或者
if ($(this).val() == "")
$(document).ready(function () {
$(".add").click(function () {
$("#text").each(function () {
if (this.val() == "") {
alert("请完整填写!");
return false;
} }); }); });
另外可以考虑用正则表达式