Question: I have a list, declared like so:

```
<ul>
  <li class="yearCategory"><a href="javascript:void(0)">2011</a></li>
  <ul class="subCategory">
  <li><a href="javascript:void(0)">January</a></li>
  <li><a href="javascript:void(0)">February</a></li>
</ul>
</ul>

```

When 'January' or 'February' are selected, I would like to return the 'yearCategory' value of that certain list, in this case 2011. 

How can this be done with jQuery? I've tried experimenting with parent and parents, but have not managed to select the correct element.

This is what i've tried so far:

```
$(this).parent("ul").next("li")

```

Answer: 
Adjust your mark up slightly since the original wasn't valid:

```
<ul>
  <li class="yearCategory">
    <a href="javascript:void(0)">2011</a>
    <ul class="subCategory">
      <li><a href="javascript:void(0)">January</a></li>
      <li><a href="javascript:void(0)">February</a></li>
    </ul>
  </li>
</ul>

```

And the jQuery:

```
$(document).ready(function() {
    $('ul.subCategory li a').click(function() {
        var year = $(this)
                     .parent()
                     .parent()
                     .parent()
                     .find('a')
                     .text();

        alert(year); // or whatever you want to do with the year
    });
});

```
A possible solution could be the following:

```
$("li.yearCategory a:fisrt", $(anchorNode).parent().parent()).text();

```

...but to simplify things I would add an id to the parent ul, by allowing a simple selector like:

```
$("ul#myid li.yearCategory a:first").text()

```