手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery foreach使用示例
jquery foreach使用示例
摘要:复制代码代码如下:$("input").each(function(index){//取得整个页面的input值$("input:text"...

复制代码 代码如下:

<form id="input_iForm" action="${pageContext.request.contextPath}/transfer/input_salary.shtml">

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

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

<input type="text" 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使用示例】相关文章:

JavaScript中的Math.SQRT1_2属性使用简介

jquery使用each方法遍历json格式数据实例

angular2使用简单介绍

Jquery使用css方法改变样式实例

jquery滚动特效集锦

JS中字符串trim()使用示例

JavaScript中的replace()方法使用详解

jquery.validate使用时遇到的问题

JQuery中层次选择器用法实例详解

jQuery中 prop() attr()使用详解

精品推荐
分类导航