CNode

JQuery 数组遍历方法

问答
ZzWorker9902发布于8 年前最后回复8 年前0 回复3318 浏览0 收藏

JQuery 数组遍历方法

方法一

// 遍历选项
$domSource.find("li").each(function(index, element){ var sourceObj = aryVodeoSource[index]; if (sourceObj != undefined){ $(this).attr("value", sourceObj.index); $(this).text(sourceObj.alias); } else{ $(this).remove(); } }); 1 2 3 4 5 6 7 8 9 10 11 12 方法二

// 遍历数组 for(var i=$domSource.find("li").length; i<aryVodeoSource.length; i++){ $domSource.find("ul")[0].appendChild(createSingleBoxLi(aryVodeoSource[i].index, aryVodeoSource[i].alias)); } 1 2 3 4 方法三

// 遍历数组 $.each(aryVodeoSource,function(index,value){ if(value.index == videoSourceIndex){ $domSource.webumcSelect("value", value.alias); } });

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。
参与回复
登录后即可参与回复。登录