开发者

What would this raw javascript selector be in JQuery?

开发者 https://www.devze.com 2023-01-08 09:34 出处:网络
Here is the piece of javascript that correctly identifies a UL element: $(this.parentNode.nextSibling.nextSibling.children[0]);

Here is the piece of javascript that correctly identifies a UL element:

$(this.parentNode.nextSibling.nextSibling.children[0]);

The html it looks over is: (with 'this' referring to the .cs_previ开发者_运维知识库ousArrow as the initial selector)

  <div id="cs_furlBar1">
      <p class="cs_furlHeaderClosed">INVESTOR SERVICES</p>
      <p class="cs_seeAllFurl"><a href="#">See all</a></p>
    </div>
    <div id="cs_investorServ" class="cs_hideOpen">
        <div class="cs_previousArrow"><img class="previous_btn" src="images/previousArrow.gif" width="11" height="21" alt=""></div>
      <div class="cs_vidThumbClip"></div>

in the div of cs_VidThumbClip, I use the load() action to insert a UL which has the class of cs_vidThumbList

So, the above javascript, after some bouts with Firebug, works but I'm thinking there must be a shorter (or better?) of selecting the same element.

The whole point of this is that I have 5 different divs each which will have its own content loaded to be scrolled so I wanted to avoid have the same code duped and then just the id changed.

Thanks


You can try

$('ul.cs_vidThumbList', $(this).parent().parent())
0

精彩评论

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