I have 5 div
tags with the same class. Each div
tag has a textbox and a dropdownlist with numbers.
如果所有这些<代码>div,标签箱和落户名单都是空的,如果是“做些什么”,我怎么可以检查。
$step
is an array with all of my div
tags.
var $step = $(".wizard-step2:visible");
我的文箱有一门<条码>Comment,我的博士生有一门<条码>。 Grade。
迄今为止,我已经把这个问题编成法典,但错了,我不想在每一张<条码>div标签上进行检查,我希望检查所有这些编号。
这部法律是错误的:
var Comment = $step.find(".Comment").val();
var Grade = $step.find(".Grade").val();
for (var i = 0; i < $step.length; i++) {
if (Comment != null && Grade > 0) { {
// do this
}
} else {
alert("You must enter both fields");
}
}
EDIT:
I think that I did not explain my question well, my code works like all of the answers I got on this question. I dont want to make this if statement to check each div tag. I want to be able to check if all of the div tags have any empty fields do something " else if all the div tags fields are filled do something.
Users are allowed to leave the fields empty, but if all of the div tags fields are filled do something.
I do not want to do a if statement for each div tag, I want to do a if statement if all the div tags have any empty fields or if all are field.
请允许我说,我有5个tag子。 我已经填满了其中4个,当我填满了最后5个小批。 在此,我希望“做些什么”,否则就不应该发生。 我原想的是,如果在填满的第1号、第2号、第3号、第4号等地上填写声明,如果在第5号填满时作出声明,那么所有四级标的填满,就不必做任何事情。