li:last and li.last are not the same element. li.last is the <li class="last lastActive"> element, while li:last is giving you the *last* LI in the collection of *all* the LI's descending from ".leftNav ul" - that is the <li><a href="#">HAX</a></ li> element.
Enforcing the child relationship should give you the expected results: $(".leftNav .menu > ul > li:last")[0] == $(".leftNav ul li.last")[0] cheers - ricardo On Feb 12, 4:56 pm, Alexandru Dinulescu <alex.d.a...@gmail.com> wrote: > Here is the Link of the page in question. > > THIS WORKS:http://alexd.adore.ro/projects/threadsmith/getIdeas.html > > $(document).ready(function(){ > > if($(".leftNav ul li:last").height() < 32){ > $(".leftNav ul li.last").addClass("lastWithItems"); > > } > > }) > > THIS DOESNT;http://alexd.adore.ro/projects/threadsmith/getIdeas2.html > > $(document).ready(function(){ > > if($(".leftNav ul li:last").height() < 32){ > $(".leftNav ul li:last").addClass("lastWithItems"); > > } > > }) > > THIS DOESNT ALSOhttp://alexd.adore.ro/projects/threadsmith/getIdeas3.html > > $(document).ready(function(){ > > if($(".leftNav ul li.last").height() < 32){ > $(".leftNav ul li:last").addClass("lastWithItems"); > > } > > }) > > ------------------- > Alexandru Dinulescu > Web Developer > (X)HTML/CSS Specialist > Expert Guarantee Certified Developer > XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053 > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619 > RentACoder > Profile:http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf... > > MainWebsite:http://alexd.adore.ro > Portofolio:http://alexd.adore.ro/project_page.php > > On Thu, Feb 12, 2009 at 7:15 PM, Liam Potter <radioactiv...@gmail.com>wrote: > > > > > Hi Alexandru, > > > I cannot see any reason why li.last would not work, as it would be no > > different then selecting any li with any class. > > > Alexandru Dinulescu wrote: > > >> So this should work right? > > >> function blabla() { > >> } > > >> $(document).ready(blabla); > > >> --- > > >> Any info why the li:last and li.last do not work? > > >> the html was something like this > >> <ul> > >> <li>Test Test Test </li> > >> <li>Test Test Test </li> > >> <li class="last">Test Test Test </li> > >> </ul> > > >> so li.last and li:last equal the same thing > > >> Thanks for all the info so far > >> ------------------- > >> Alexandru Dinulescu > >> Web Developer > >> (X)HTML/CSS Specialist > >> Expert Guarantee Certified Developer > >> XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053 > >> CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619 > >> RentACoder Profile: > >>http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf... > > >> MainWebsite:http://alexd.adore.ro > >> Portofolio:http://alexd.adore.ro/project_page.php > > >> On Thu, Feb 12, 2009 at 6:38 PM, MorningZ <morni...@gmail.com <mailto: > >> morni...@gmail.com>> wrote: > > >> "So all the parantheses are where they belong.." > > >> you should not use () in the document.ready line > > >> $(document).ready(blabla()) > > >> won't work > > >> $(document).ready(blabla) > > >> will work > > >> On Feb 12, 11:32 am, Alexandru Dinulescu <alex.d.a...@gmail.com > >> <mailto:alex.d.a...@gmail.com>> > >> wrote: > >> > Also i didnt say this > > >> > I said > >> > function blabla() { > > >> > > } > > >> > > $(document).ready(blabla()) ? > > >> > So all the parantheses are where they belong... > >> > ------------------- > >> > Alexandru Dinulescu > >> > Web Developer > >> > (X)HTML/CSS Specialist > >> > Expert Guarantee Certified Developer > > >> XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053 > >> > CSS :http://www.expertrating.com/transcript.asp?transcriptid=1870619 > >> > RentACoder > >> Profile: > >>http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf... > > >> > MainWebsite:http://alexd.adore.ro > >> > Portofolio:http://alexd.adore.ro/project_page.php > > >> > On Thu, Feb 12, 2009 at 5:40 PM, MorningZ <morni...@gmail.com > >> <mailto:morni...@gmail.com>> wrote: > > >> > > For the first part of your post > > >> > > li:last gets the last <li> in the given <ul> > > >> > > li.last gets any <li> with the class of "last" > > >> > > For the second part of your post, your syntax is wrong > > >> > > $(document).ready(blabla) > > >> > > (note the lack of () after the function name) > > >> > > On Feb 12, 8:59 am, Alexandru Dinulescu <alex.d.a...@gmail.com > >> <mailto:alex.d.a...@gmail.com>> wrote: > >> > > > Why does this : > > >> > > > $(document).ready(function(){ > > >> > > > if($(".leftNav ul li:last").height() < 32){ > >> > > > $(".leftNav ul li.last").addClass("lastWithItems"); > > >> > > > } > > >> > > > }) > > >> > > > work in 1.3.1 but not this > > >> > > > $(document).ready(function(){ > > >> > > > if($(".leftNav ul li.last").height() < 32){ > >> > > > $(".leftNav ul li.last").addClass("lastWithItems"); > > >> > > > } > > >> > > > }) > > >> > > > (Notice the li.last on both lines) ??? Also why isnt it > >> explained > >> > > anywhere > >> > > > :( > > >> > > > Another thing > > >> > > > why cant i do this > > >> > > > function blabla() { > > >> > > > } > > >> > > > $(document).ready(blabla()) ? > > >> > > > and i have to do $(document).ready(function(){}) > > >> > > > From what i recall i could do both things in 1.2.6, now with > >> 1.3.1 those > >> > > > seem to be impossible, also why isnt there any mention on > >> the Jquery > >> > > > doc/tutorial pages? :( > > >> > > > Thanks > >> > > > ------------------- > >> > > > Alexandru Dinulescu > >> > > > Web Developer > >> > > > (X)HTML/CSS Specialist > >> > > > Expert Guarantee Certified Developer > > >> XHTML:http://www.expertrating.com/transcript.asp?transcriptid=1879053 > >> > > > CSS > >> :http://www.expertrating.com/transcript.asp?transcriptid=1870619 > >> > > > RentACoder Profile: > > >>http://www.rentacoder.com/RentACoder/DotNet/SoftwareCoders/ShowBioInf... > > >> > > > MainWebsite:http://alexd.adore.ro > >> > > > Portofolio:http://alexd.adore.ro/project_page.php