循环遍历name相同的textarea 校验是否有值
<c:forEach items="${contractGenerationList}" var="contractGeneration" varStatus="st">
<tr>
<c:if test="${textFlag==1}">
<td name="recordingPrintTd">
<textarea name="recordingPrint" style="width:90%" rows="4" cols="10"
style="font-size:px" οnblur="checkData1(this);"></textarea><span class="r_star" id="textSpanId"></span>
</td>
</c:if>
</tr>
</c:forEach>
$("textarea[name='recordingPrint']").each(function(){
if(this.value == null || this.value =='' ){
this.nextSibling.innerHTML="请填写补打原因!";
return false;
}else{
this.nextSibling.innerHTML = "";
}
});
循环遍历name相同的Input 'text'校验是否有值
$("input[type='text'][name='printNum']").each(function(){
if(this.value.isInt() == false){
this.nextSibling.nextSibling.innerHTML = "请填写整数!";
this.focus();
return false;
}else{
this.nextSibling.nextSibling.innerHTML = "";
}
});
循环遍历checkbox 全选
$("#checkAll").click(function() {
if ($(this).attr("checked") == true) {
$("input[type='checkbox']").each(function() {
$(this).attr("checked", true);
});
} else {
$("input[type='checkbox']").each(function() {
$(this).attr("checked", false);
});
}
});