开发者

How to find a List item by using its id

开发者 https://www.devze.com 2023-03-21 13:14 出处:网络
How to find a List item by using its id..i tried like below...But it is 开发者_如何学Pythonnot works for me...

How to find a List item by using its id..i tried like below...But it is 开发者_如何学Pythonnot works for me...

 $("#tabs li").find("#" + tabName+"1").addClass("current");

Please help me...


Check this

  <ul>
    <li>foo</li>
    <li>bar</li>
  </ul>

We can select the list items and iterate across them:

$('li').each(function(index) {
    alert(index + ': ' + $(this).text());
  });


$("#" + tabName+"1").addClass("current");

? :)


$('li').each(function() {
var checkID = $(this).attr("id");
//now if you find the id your are searching for
 if(checkID=="searchedID")
  {
    $(this).addClass('yourClass');
   }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消