js中循环遍历
2013-05-11 09:32
218 查看
循环遍历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" onblur="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);
});
}
});
<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" onblur="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);
});
}
});
相关文章推荐
- JS简单循环遍历json数组的方法
- JS 循环遍历JSON数据
- JS循环遍历json数据
- JS 循环遍历JSON数据
- JS 循环遍历JSON数据
- JS循环遍历JSON数据的方法
- JS 循环遍历JSON数据
- JS循环遍历JSON数据的方法
- JavaScript基础精华03(String对象,Array对象,循环遍历数组,JS中的Dictionary,Array的简化声明)
- 关于js中循环遍历中顺序执行多个嵌套ajax的问题
- 【JS--基础--语句】--for in 循环遍历语句
- jquery 实现Ajax,JS 循环遍历JSON数据
- JavaScript基础精华03(String对象,Array对象,循环遍历数组,JS中的Dictionary,Array的简化声明)
- JS封装(循环遍历添加)
- js中把已知对象循环遍历出来再存入新的数组中
- JS 循环遍历JSON数据
- js的循环遍历
- JS 循环遍历JSON数据
- js循环遍历的两种方法for循环和for ... in 循环
- js 数组循环遍历