jquery显示和隐藏以及复选框状态

时间:2013-04-10 18:20:30

标签: jquery cordova

情况:

我有一个列出一群人的UL 我在“All”和“Common”上面有两个按钮

在负载下你会看到所有人。然后,您可以单击“公共”按钮,UL将仅过滤到某些人。

这很好用。但是在每个LI中我有2个复选框 - 当我在All类别中检查它们然后选择Recent选项卡以检查其他人然后我回到All选项卡我有时会丢失复选框状态。

应该注意的是,这是用phonegap开发的

function getFriends(common)
{

if(common=="common")
{  
   //Hide everyone to start with
   $("#PersonSelection li").hide();
   //ajax query that loops through the common players goes here
   $('#'+item.PlayerId).show(); //this is the id of each li that is common, so after I hide all I   just show those that are common
   //end ajax loop
} else {
  if ($("#PersonSelection li").size() > 1) //this is there for when we go from common back to all I don't have to go back to the DB
  {
   $("#PersonSelection li").show();
  }
  else
    {
    //go back to ajax query that loops a variable with li and checkbox info and the appends
    document.getElementById('PersonSelection').innerHTML += people;
    }
}

1 个答案:

答案 0 :(得分:0)

好吧我明白了 - 我以为我调试得很好,但是这个问题和问题一直存在.getElementById('PersonSelection')。innerHTML + = people;