traversing - how to access jQuery object
I have very simple question (ie probably simple for everyone with jQuery experience, but not for me).
Lets say I have the following list
- <div>
- <li id="first"><a>one</a></li>
- <li><a>two</a></li>
- <li><a>three</a></li>
- <li><a>four</a><li>
- </div>
Now, if I want to get all the list items after the first, and change the text within the anchor tags, if a certain condition is met (eg change to capitals if it starts with a "t"). How can I do that?
My approach was to get all the list items (after the first) with
- var listitems = $('#first').nextAll();
and then loop through them to change them
- for (var i = 0; i < listitems.length; i++) {
- var text = listitems[i].find('a').text();
- ....
But this line goes wrong. If I understand correctly listitems is a jQuery object, but then question is how do I access it?