views:

38

answers:

1

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.

+3  A: 

How about $(this).find('img').andSelf() ?

Marc Gravell
or something like `$(this).find("img").add(this)` should work
David Murdoch