this should work: if ($("#medalist > ul > li:active img").length() > 0) { // has image inside <li></li> }
On Oct 13, 3:52 am, jdenkaat <[EMAIL PROTECTED]> wrote: > Hi > > If I have the following list and I want to find if the contents of <li > class="active"> is an image how would I do it? > > <div id="medalist"> > <ul> > <li class="active"><img src="media/nin2.jpg"></a></li> > <li><a href="media/nintendo.swf"></a></li> > <li><img src="media/nin2.jpg"></li> > <li><img src="media/nin3.jpg" ></li> > </ul> > </div> > > I have tried the following: > > if ($('#medialist li.active.is(img)')){ > alert("true"); > > }); > } > else{ > alert("false"); > } > but I'm fairly sure that the if ($('#medialist li.active.is(img)')) > { line is wrong. > > Could someone point me in the right direction > > Thanks in advanced > > Jdenkaat