Try:

$(document).ready(function(){
if ($('#medalist li.active').children().is('img')){
 alert("true");
 }else{
 alert("false");
}
});

There are typos errors  in your sintaxe. Double check it!



-----Mensagem Original----- De: "jdenkaat" <[EMAIL PROTECTED]>
Para: "jQuery (English)" <jquery-en@googlegroups.com>
Enviada em: segunda-feira, 13 de outubro de 2008 05:52
Assunto: [jQuery] Check if contents of lis is an image



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

Reply via email to