<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jquery数组遍历</title> <script type="text/javascript" src="../js/jquery-1.7.2.js"></script> <script type="text/javascript" src="../js/jquery.validate-1.14.0.js"></script> <script type="text/javascript"> $(document).ready(function () { //遍历遍历JSON: // $.each([{"name":"limeng","email":"xfjylimeng"},{"name":"hehe","email":"fjylimeng"}],function(index,data) // { // alert("索引:"+index+","+"对应值为:"+data.name+" "+"email: "+data.email); // }); //遍历MAP: // var map = {one: 1, two: 2, three: 3, four: 4}; // $.each(map, function (key, value) { // alert(key + " " + value); // // }) //遍历list: // var list = ["one", "two", "trhee", "four"]; // $.each(list, function () { // alert(this); // }) // 遍历数组: var arr = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; $.each(arr, function (index, data) { $.each(data,function (j) { alert(data[j]); }) }) }) </script> </head> <body> </body> </html>
使用jQuery进行遍历
最新推荐文章于 2022-09-19 11:35:55 发布