1.循环遍历
each方法定义如下:
方法定义:$(selector).each(function(index,element)) index - 选择器的 index 位置 element - 当前的元素(也可使用 "this" 选择器)
遍历元素集合:
$("li").each(function(){ alert($(this).text()) });
遍历数据集合
//rows为数据集合,i为记录索引,a为一条记录 $.each(rows, function (i, a) { alert(a.name); });