联系我们
简单又实用的WordPress网站制作教学
当前位置:网站首页 > 网页前端技术 > 正文

jquery foreach使用示例 - Web前端

作者:98wpeu发布时间:2026-06-18分类:网页前端技术浏览:2


导读:复制代码代码如下:<FORMid="input_iform"action="${pageContext.request.contextPath}/transfer/in...
复制代码 代码如下:
<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) {
varevents = [];
$(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);
}
});

标签:示例Webforeachjquery


网页前端技术排行
最近发表
网站分类
标签列表