【发布时间】:2014-06-11 11:58:44
【问题描述】:
尝试在jquery each 方法中添加两个数组,并尝试根据逻辑显示不同的文本。
我有两个数组,demo 和 catID。演示数组工作正常,当进入 catID 数组时 jquery .each 无法正常工作,它仍然返回一个数组。那就是条件失败了,它无法从数组中找出完全匹配的值。谁能帮帮我?
JS:
function App( ){
var Label = ‘a’;
var KeyLabel = 'cat';
var demo = [“a”,”b”,’c’,’d’];
var CatID =['1','2','3'];
scatID='1';
jQuery.each( [demo,CatID], function( index, value) {
debugger;
if((Label==value)&&(scatID==CatID)){
debugger;
$scope.snewText = 'Hello from A';
$scope.scatText = 'Cat ID';
}
});
}
【问题讨论】:
标签: javascript jquery arrays angularjs