Because you forgot to close the de first ul element.
Mauricio

-----Mensagem Original----- De: <[EMAIL PROTECTED]>
Para: "jQuery (English)" <jquery-en@googlegroups.com>
Enviada em: terça-feira, 28 de outubro de 2008 10:07
Assunto: [jQuery] JQuery selector



Hi everyone,

I have a question on JQuery selector. I want to add a class, last,
into li elements where have <!-- This is the one --> comment next to
it under different ul but have the same class "u".

This is what I ended up with. However, it only selects "li" final two.
$(".u > li:last-child").addClass("last");

<body>
<div id="d1">
This is content
</div>
<ul class="u">
<li>1</li>
<li>2</li>
<li>final one</li> <!-- This is the one -->
<ul class="l">
<li>11</li>
<li>22</li>
</ul>
</ul>
<ul class="u">
<li>3</li>
<li>4</li>
<li>final two</li> <!-- This is the one -->
</ul>
</body>

Any help will be appreciated. Thanks.

Reply via email to