您的位置:首页 > Web前端 > JavaScript

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);

});

}

});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: