element[element.childNodes.length-1] wouldn't work if lastChild is a whitespace. $$('ul li:last-child') on the other hand will always return element node.
- kangax On Mar 26, 10:19 am, Diodeus <[EMAIL PROTECTED]> wrote: > Give your UL an ID. For the example, I used 'moo'. > > alert($('moo').childNodes[$('moo').childNodes.length-1].innerHTML) > > You should see "item3" appear in the alert box. > > On Mar 26, 9:51 am, smartcookie <[EMAIL PROTECTED]> wrote: > > > Given this structure: > > <ul> > > <li>item1</li> > > <li>item2</li> > > <li>item3</li> > > </ul> > > > Whats the best method of finding the last item in the list? > > > thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---