I have a set of list items that contain nested lists, sort of like this:

```
<ul class="searchselectors">
  <li class="group">Group name 1
    <ul>
      <li class="item selected">List item 1.1</li>
      <li class="item">List item 1.2</li>
      <li class="item">List item 1.3</li>
    </ul>
  </li>
  <li class="group">Group name 2
    <ul>
      <li class="item">List item 2.1</li>
      <li class="item">List item 2.2</li>
      <li class="item">List item 2.3</li>
    </ul>
  </li>
  <li class="group">Group name 3
    <ul>
      <li class="item">List item 3.1</li>
    </ul>
  </li>
</ul>

```

I want to cycle through all of the `.item` elements using up/down arrow keys (which I already have set up by using `on('keydown')` and catching key codes `38` and `40`) and set `.selected` on the next item before or after the currently selected item, wrapping around to the top/bottom as necessary.

Using `$().next()` and `$().prev()` will not work, since it will only work on **siblings**, and not on a jQuery object such as `$('.searchselectors .item')`.\