You're comparing two different (ie non-equal) jQuery objects that happen to
contain (in an array-like fashion) the same DOM Element. If you want to
compare those two DOM Elements, change

$("#phrases").find("li.active") != $("#phrases").find("li:first")

to

$("#phrases").find("li.active")[0] != $("#phrases").find("li:first")[0]

- Richard

On Wed, Dec 10, 2008 at 3:05 AM, nachocab <[EMAIL PROTECTED]> wrote:

>
> Hi,
> I have this html:
>
> <ul id="phrases">
>  <li id="phrase_0" class="active">This is my first phrase</li>
>  <li id="phrase_1">This is my second_phrase</li>
> </ul>
>
> And I wanted to do this comparison:
>  if ( $("#phrases").find("li.active") != $("#phrases").find
> ("li:first") ) {
>   alert("the active list-item is not the first one");
> }
>
> The problem is the alert pops up, but in this case the first item is
> clearly the active one. Can anybody figure out what's wrong?
>
> Thanks!
>
> Nacho
>
>
>

Reply via email to