How to select the 2nd child of a 'closest' parent?
Hello all.
I am trying to figure out the syntax for the following. For this version I am simply trying to select the 2nd child of the SLIDE HOLDER div. For this test I am just making the width grow. My next pass will be to get the index of the DOT clicked and then pass it to the child of the other parent. Please see line 24. I know this is incorrect but placed it to give you an idea of what I am trying to accomplish. Thanks!!
- <div class="slide_holder">
- <div class="slide">XXX</div>
- <div class="slide">I AM THE SECOND CHILD</div>
- <div class="slide">XXX</div>
- <div class="slide">XXX</div>
- </div><!-- END slideHolder -->
- <div class="slide_dot_holder">
- <div class="slider_dot"> </div>
- <div class="slider_dot">CLICK ME HERE TO RUN FUNCTION</div>
- <div class="slider_dot"> </div>
- <div class="slider_dot"> </div>
- </div><!-- END slideDotHolder -->
- <script>
- spotlight1_rw_slide_show();
- $('.slider_dot').click(function(){
- var index = $('.slider_dot').index(this)+1;
- $(this).closest('div.slide_holder').children().('.slide:nth-child(2)').css({'width':'200px'});
- });
- </script>
Thanks again
Rich