Jquery (this) selector help

Posted by mtwallet on Stack Overflow See other posts from Stack Overflow or by mtwallet
Published on 2010-06-14T13:03:25Z Indexed on 2010/06/14 13:12 UTC
Read the original article Hit count: 95

Filed under:
|
|

Hi. I have the following HTML:

<div class="box"><img src="pic.jpg" alt="image" /></div>
<div class="box"><img src="pic.jpg" alt="image" /></div>
<div class="box"><img src="pic.jpg" alt="image" /></div>
<div class="box"><img src="pic.jpg" alt="image" /></div>

I am trying to select the div and the child image both at the same time. I need to use $(this) to select the div. I know I can use $(this).children() or $(this).find('img') to get the image. Is there a way to select both the div and image using $(this) for the div.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors