最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Manipulating object HTMLLIElement - Stack Overflow

programmeradmin2浏览0评论

I am trying to get the li tag from a ul element and then hide them but when i call the hide function I get Object # has no method 'hide'

 var li = $(this).siblings("ul").children("li");
 li.get(0).hide ();

I think that the problem is that I can't call regular jquery method unless its a object if so how can I get the object and not or if not how do I call methods form

I am trying to get the li tag from a ul element and then hide them but when i call the hide function I get Object # has no method 'hide'

 var li = $(this).siblings("ul").children("li");
 li.get(0).hide ();

I think that the problem is that I can't call regular jquery method unless its a object if so how can I get the object and not or if not how do I call methods form

Share Improve this question asked Feb 12, 2013 at 20:14 user2054833user2054833 2,1657 gold badges25 silver badges41 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

.get(0) returns the native element.

To hide the first element, use .eq() instead:

li.eq(0).hide();
发布评论

评论列表(0)

  1. 暂无评论