[jQuery] Re: Need help traversing an unordered list

2008-11-09 Thread Paul Mills

Hi,
I've found a slightly messy solution which is to grab the html for
each li element and then strip off the ul tags. It works but is
dependent on the exact sequence of code.

I would make things easy for myself by adding some extra tags. Such as
putting h2 tags around the Tilte  text - then it's easy to grab it.
It's also more semantic as the Title text is a header.

I've put my code in the jsbin page.
http://jsbin.com/axeji/edit

Paul


On Nov 7, 7:03 pm, Logictrap [EMAIL PROTECTED] wrote:
 How do I access just the titles (ie 'Title 1', 'Title 2')? Every
 method I tried also includes the content.

 I tried using: not('[li])  parent()

 This is an example list structure. I want to be able to get just
 the titles: (ie Title 1, Title 2, Title 3)

 ul id=mylist
  li Title 1
    ul
      liContent 1/li
    /ul
  /li
  liTitle 2
    ul
      liContent 2/li
    /ul
  /li
  liTitle 3
    ul
      liContent 3/li
    /ul
  /li
 /ul


[jQuery] Re: Need help traversing an unordered list

2008-11-09 Thread Logictrap

Thank you - that's exactlyt what I was looking for. The semantic
approach seems a better approach as you described.

Thanks again.



On Nov 9, 4:23 am, Paul Mills [EMAIL PROTECTED] wrote:
 Hi,
 I've found a slightly messy solution which is to grab the html for
 each li element and then strip off the ul tags. It works but is
 dependent on the exact sequence of code.

 I would make things easy for myself by adding some extra tags. Such as
 putting h2 tags around the Tilte  text - then it's easy to grab it.
 It's also more semantic as the Title text is a header.

 I've put my code in the jsbin page.http://jsbin.com/axeji/edit

 Paul

 On Nov 7, 7:03 pm, Logictrap [EMAIL PROTECTED] wrote:

  How do I access just the titles (ie 'Title 1', 'Title 2')? Every
  method I tried also includes the content.

  I tried using: not('[li])  parent()

  This is an example list structure. I want to be able to get just
  the titles: (ie Title 1, Title 2, Title 3)

  ul id=mylist
   li Title 1
     ul
       liContent 1/li
     /ul
   /li
   liTitle 2
     ul
       liContent 2/li
     /ul
   /li
   liTitle 3
     ul
       liContent 3/li
     /ul
   /li
  /ul