我是靠谱客的博主 复杂可乐,这篇文章主要介绍jquery foreach使用示例,现在分享给大家,希望可以做个参考。

复制代码 代码如下:

<form id="input_iForm" action="${pageContext.request.contextPath}/transfer/input_salary.shtml">
<input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>

<input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>

<input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>

</form>

$("input").each(function(index){ //取得整个页面的input值

$("input:text").each(function(index){
alert(index);//循环的下标值,从0开始
alert(this.value); alert($(this).attr("type")); //自带属性可以用this(Dom)直接取值
alert($(this).attr("vili")); //自定义属性需要用attr(Jquery)取值
//if($(this).attr("vili")=="true"&&){
  
//}
});

复制代码 代码如下:

$.ajax({
url: '<%=basePath%>schedule/getMonthRecordLs.action',
dataType: 'json',
success: function(data) {
var events = [];
$(data).each(function(i,val) {
events.push({
id: val.sc_id,
title: val.sc_planemp,
start: new Date(val.sc_date),
color: val.sc_classes=='1'?'':'#993300'
});
});
callback(events);
}
});

最后

以上就是复杂可乐最近收集整理的关于jquery foreach使用示例的全部内容,更多相关jquery内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(306)

评论列表共有 0 条评论

立即
投稿
返回
顶部