Only change img inside children li

Posted by steve on Stack Overflow See other posts from Stack Overflow or by steve
Published on 2010-05-18T04:20:09Z Indexed on 2010/05/18 4:30 UTC
Read the original article Hit count: 124

Filed under:
|

Say my code is as follows:

<ul>
   <li><img /></li>
   <li>
      <ul>
         <li><img /></li>
      </ul>
   </li>
</ul>

I'm trying to set a default size for the first img tag, but not affect the second one. everything I do affects the other one as well. Currently I have tried:

$('ul#gallery > li').find('img').css('width','650px');
$('ul#gallery > li img').css('width','650px');

among others, but nothing works.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about lists