1. <form id="input_iForm" action="${pageContext.request.contextPath}/transfer/input_salary.shtml">
  2. <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>
  3. <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>
  4. <input type="text" class="input_w150" vili="true" onkeyup="formatBankNo(this)"/>
  5. </form>
  6. $("input").each(function(index){ //取得整个页面的input值
  7. $("input:text").each(function(index){
  8. alert(index);//循环的下标值,从0开始
  9. alert(this.value);  alert($(this).attr("type"));  //自带属性可以用this(Dom)直接取值
  10. alert($(this).attr("vili"));                               //自定义属性需要用attr(Jquery)取值
  11. //if($(this).attr("vili")=="true"&&){
  12. //}
  13. });
  1. $.ajax({
  2. url: '<%=basePath%>schedule/getMonthRecordLs.action',
  3. dataType: 'json',
  4. success: function(data) {
  5. var events = [];
  6. $(data).each(function(i,val) {
  7. events.push({
  8. id: val.sc_id,
  9. title: val.sc_planemp,
  10. start: new Date(val.sc_date),
  11. color: val.sc_classes=='1'?'':'#993300'
  12. });
  13. });
  14. callback(events);
  15. }
  16. });

jquery foreach的更多相关文章

  1. JS与Jquery区别

    很多人对JS和JQuery很容易搞混淆,今天我们就相比学习下: 加载区别: var myfunction(){}; JS:1.window.onload=function(){} 2.<body ...

  2. 原生js使用forEach()与jquery使用each遍历数组,return false 的区别

    原生js使用forEach()与jquery使用each()遍历数组,return false 的区别: 1.使用each()遍历数组a,如下: var a=[20,21,22,23,24]; $.e ...

  3. JavaScript、jQuery、fish的遍历方法(each、forEach)总结

    起因 在工作中,需要在遍历的dom中找到第一个并做下操作然后退出遍历,我首先想到了用each方法,但由于无论是公用的jQuery组件还是公司的fish组件.我都忘记了怎么去退出遍历,所以就有了这篇帖子 ...

  4. javascript里面foreach遍历函数介绍,以及跟jquery里面each的区别

    foreach是把数组从头到尾遍历一遍,有三个参数分别是:数组元素,数组索引,数组本身.如果是一个参数,就是数组元素. var data=[1,2,3,4,5,6]; var sum=0; data. ...

  5. Jquery 对象集合的迭代扩展forEach

    if (jQuery && !jQuery.fn.forEach) { $(function () { (function ($) { $.fn.extend({ forEach: f ...

  6. js原生forEach、map与jquery的each、$.each的区别

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  7. Javascript/Jquery 中each() 和forEach()的区别

    从名字看上去这两个方法好像有点关系,但在javascript中它们区别还是挺大的. forEach() 用于数组的操作,对数组中的每个元素执行制定的函数(不是数组不能使用forEach()方法). 而 ...

  8. jQuery each和js forEach用法比较

    本文实例分析了jQuery each和js forEach用法.分享给大家供大家参考,具体如下: 对于遍历数组的元素,js代码和jquery都有类似的方法,js用的是forEach而jquery用的是 ...

  9. 使用jstl的Foreach 和jquery的each()的index属性

    最近项目中用到隔行换色问题,使用到了jstl的foreach和jquery的each进行遍历. 首先jstl技术.除了常用的items,var外,还有一个下标属性varStatus,从0开始,使用起来 ...

随机推荐

  1. Nginx-location配置指南

    语法规则: location [=|~|~*|^~] /uri/ { … } = 开头表示精确匹配 ^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即可.nginx不对url做编码,因 ...

  2. SPRING IN ACTION 第4版笔记-第九章Securing web applications-006-用LDAP比较密码(passwordCompare()、passwordAttribute("passcode")、passwordEncoder(new Md5PasswordEncoder()))

    一. The default strategy for authenticating against LDAP is to perform a bind operation,authenticatin ...

  3. Qt串口通信接收数据不完整的解决方法(传输图片)

    在使用串口接收数据时,当数据量大的时候会出现数据接收不完整的情况.因为串口数据获取函数readAll()由readyRead()信号触发,但readyRead()信号在串口读到起始标志时立即发送,并不 ...

  4. UVA548——Tree(中后序建树+DFS)

    Tree You are to determine the value of the leaf node in a given binary tree that is the terminal nod ...

  5. objective-C 自定义对象归档的实现

    自定义对象要实现归档必须实现NSCoding协议 NSCoding协议有两个方法,encodeWithCoder方法对对象的属性数据做编码处理,initWithCoder解码归档数据来初始化对象. # ...

  6. java事务管理(二)

    数据库事务和Spring事务是一般面试都会被提到,很多朋友写惯了代码,很少花时间去整理归纳这些东西,结果本来会的东西,居然吞吞吐吐答不上来. 下面是我收集到一些关于Spring事务的问题,希望能帮助大 ...

  7. Angularjs checkbox的ng属性

    angularjs 默认给 input[checkbox] 元素定制了一些属性,如: <input type="checkbox" ng-mudel="name&q ...

  8. Can't obtain the input stream from /docProps/app.xml

    今天在做poi修改样式时,报了以下错误: Exception in thread "main" org.apache.poi.POIXMLException: java.io.IO ...

  9. 函数buf_LRU_free_from_unzip_LRU_list

    /******************************************************************//** Try to free an uncompressed ...

  10. I.MX6 PMU MMPF0100 driver porting

    /************************************************************************** * I.MX6 MMPF0100 driver ...