开发者

How to SELECT the following element in jQuery

I have a group of nested divs

<div id="myDivs">
  <div>
    <div>
      <div></div>
    </div>
    <div></div>
    <div></div>
  </div>
</div>

Using jquery, ho开发者_如何转开发w do I select the div that is immediately beneathe myDivs, but NONE of it's children?

thnx!


Use the child selector: $('#myDivs > div')


Since the first element is an id selector, the following way will faster. But only noticed the difference in a very complex document.

$('#myDivs').find('div')
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜