Three traversal methods of each in Jquery

韦小宝
Release: 2017-11-27 10:05:21
Original
1859 people have browsed it


JqueryThe three traversal methods of each, let you see the useful each method injquery, forjqueryIf you are interested, you can collect it and take a look!

1. Selector + traversal

$('div').each(function (i){

i is the index value

this means getting and traversing each DOM object

});

2. Selector + traversal

$('div' ).each(function (index,domEle){

index is the index value

domEle means getting and traversing each dom object

});

3. A more applicable traversal method

1) First obtain a collection object

2) Traverse each element of the collection object

var d =$("div");

$.each(d,function (index,domEle){

d is the collection to be traversed

index is the index value

domEle means to traverse each dom pair

});

    属性选择器学习   

美女 美男 大爷 大妈





Copy after login

The above is a brief description and code demonstration of the three traversal methods of each in Jquery.

Related recommendations:

JQuery simulates click events and automatically triggers events

How to use jquery efficiently

jquery simulates the title prompt effect

The above is the detailed content of Three traversal methods of each in Jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!