`
123003473
  • 浏览: 1043488 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

jQuery.each

阅读更多
var arr1 = [ "one", "two", "three", "four", "five" ];   
$.each(arr1, function(){   
    alert(this);   
});   
输出:one   two  three  four   five   
var arr2 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]   
$.each(arr2, function(i, item){   
    alert(item[0]);   
});   
输出:1   4   7   
var obj = { one:1, two:2, three:3, four:4, five:5 };   
$.each(obj, function(key, val) {   
    alert(obj[key]);         
});   
输出:1   2  3  4  5 
分享到:
评论

相关推荐

    jQuery.each-v1.10.2源码

    jQuery.each-v1.10.2源码

    jQuery源码分析之jQuery.fn.each与jQuery.each用法

    本文实例讲述了jQuery源码分析之jQuery.fn.each与jQuery.each用法。分享给大家供大家参考。具体分析如下: 先上例子,下面代码的作用是:对每个选中的div元素,都给它们添加一个red类 复制代码 代码如下:$(‘div’)....

    浅谈jquery中的each方法$.each、this.each、$.fn.each

    jquery.each 方法 方法一 $("img").each(function(i,elem){  // i 下标 从零开始,  // elem == this  // $(elem).toggleClass("example"); $(this).toggleClass("example"); }); 方法二 $.each([1,2,3,4],...

    jQuery.each使用详解

    jQuery.each方法是jQuery的核心工具方法之一,通用例遍方法,可用于例遍对象和数组。不同于例遍 jQuery 对象的 $().each() 方法,此方法可用于例遍任何对象。通常需要两个参数 object:需要例遍的对象或数组。 ...

    jquery里的each使用方法详解

    jQuery和jQuery对象都实 现了该方法,对于jQuery对象,只是把each方法简单的进行了委托:把jQuery对象作为第一个参数传递给jQuery的each方法.换句话 说:jQuery提供的each方法是对参数一提供的对象的中所有的子元素...

    jQuery的$.each()遍历数组或对象的用法

    $.each()遍历数组或对象的具体用法

    jQuery.each()用法分享

    (i是索引,n是内容) 代码如下: $.each( [0,1,2], function(i, n){ alert( “Item #” + i + “: ” + n ); }); 例遍对象,同时使用成员名称和变量内容。(i是成员名称,n是变量内容) 代码如下: $.each( {...

    jQuery 1.4.1 中文参考

    11.2.1 jQuery.each(object, [callback]) 183 11.2.2 jQuery.extend([deep], target, object1, [objectN]) 183 11.2.3 jQuery.grep(array, callback, [invert]) 185 11.2.4 jQuery.makeArray(obj) 186 11.2.5 jQuery...

    Pro.jQuery.2.0

    Each topic is covered clearly and concisely, and is packed with the details you'll need to learn to be truly effective. The most important features are given a no-nonsense, in-depth treatment, and ...

    使用AJAX动态生成table表格数据和jquery.pagination.js 的分页栏

    使用jquery,动态生成table表格,使用jquery.pagination.js来实现分页栏

    [jQuery.UI.1.7.jQuery用户界面库].文字版.pdf

    Over the course of this book we'll look at each of the existing components that make up the library. We will also be looking at their configuration options and trying out their methods in order to ...

    jquery的each方法使用示例分享

    对于jQuery对象,只是把each方法简单的进行了委托:把jQuery对象作为第一个参数传递给jQuery的each方法.换句话说:jQuery提供的each方法是对参数一提供的对象的中所有的子元素逐一进行方法调用。而jQuery对象提供的...

    Jquery学习手册

    jQuery.each(function),遍历jQuery对象集合,在每个对象上执行function函数,function callback(index, domElement){this}; jQuery.size(),返回jQuery对象集合的大小 jQuery.length,相当于size()方法 jQuery....

    jQuery 1.5 API 中文版

    objjQuery.each( obj, fn( index, valueOfElement ) ) objjQuery.extend( [deep,] target, obj1 [, objN] ) arrjQuery.grep( array, fn( element, index ) [, invert] ) arrjQuery.makeArray( obj ) arrjQuery.map( ...

    JQuery $.each遍历JavaScript数组对象实例

    声明了一个JSON字符串直接遍历,在Chrome控制台下面报错,解决方法是将JSON字符串转换为JavaScript对象

    jquery.my.js

    用JavaScript原生封装的一个jQuery库,可供大家学习底层封装原理。有addClass 添加类,removeClass 删除类,toggleClass 切换类,each 遍历函数,show() 显示, hide() 隐藏,toggle() 切换, html() 获取或设置html...

Global site tag (gtag.js) - Google Analytics