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();
}
});
方法二
// 遍历数组
for(var i=$domSource.find("li").length; i<aryVodeoSource.length; i++){
$domSource.find("ul")[0].appendChild(createSingleBoxLi(aryVodeoSource[i].index, aryVodeoSource[i].alias));
}
方法三
// 遍历数组
$.each(aryVodeoSource,function(index,value){
if(value.index == videoSourceIndex){
$domSource.webumcSelect("value", value.alias);
}
});