Javascript jQuery parentsUntil在else条件下不触发
好吧,这很奇怪……我有同样的代码,在if语句中也能很好地工作……但是一旦它到达Javascript jQuery parentsUntil在else条件下不触发,javascript,jquery,jstree,Javascript,Jquery,Jstree,好吧,这很奇怪……我有同样的代码,在if语句中也能很好地工作……但是一旦它到达父语句,直到它点击else语句时才会触发 if(sArray.length > 400){ $.each(sArray, function(key, item){ $("!#"+item).parentsUntil(".#jstree").filter(".#jstree-closed").each(function () {
父语句,直到它点击else语句时才会触发
if(sArray.length > 400){
$.each(sArray, function(key, item){
$("!#"+item).parentsUntil(".#jstree").filter(".#jstree-closed").each(function () {
$aTree.jstree("close_all", this);
});
});
else{
$.each(sArray, function(key, item){
$("!#"+item).parentsUntil(".#jstree").filter(".#jstree-closed").each(function () {
//IT IS NOT MAKING IT HERE
$aTree.jstree("close_all", this);
});
});
}
你错过了2},控制台给了你什么:
if(sArray.length > 400){
$.each(sArray, function(key, item){
$("#"+item).parentsUntil(".jstree").filter(".jstree-closed").each(function () {
$aTree.jstree("check_node", this);
});
});
}// Was missing
else{
$.each(sArray, function(key, item){
console.log($("#"+item).parentsUntil(".jstree").filter(".jstree-closed"));
$("#"+item).parentsUntil(".jstree").filter(".jstree-closed").each(function () {
//IT IS NOT MAKING IT HERE
console.log("pass");
$aTree.jstree("check_node", this);
});
});
}
控制台显示错误?没有显示错误但是如果是这样的话…我的第一个if不会发射…不是这样的情况你说的错误是什么意思?控制台中没有输出?错误?