using .closest with .click
<p>I'm attempting to use .closest to grab the closest <code>&lt;li&gt;</code> value based on clicking one of the <code>&lt;li&gt;</code> elements.  I'm not having much luck.  First off, I'm not having much luck trying to figure out how to add the <code>.click</code> part to the <code>.closest</code>.</p>

<p>Thanks in advance.</p>

<pre><code> &lt;script&gt;

 $(document).ready(function() { 



 var test = $('#test').closest('li').text();

 alert(test);

 });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;tbody&gt;


&lt;ul id="test"&gt;
    &lt;li&gt;1&lt;/li&gt;
    &lt;li&gt;2&lt;/li&gt;
    &lt;li&gt;3&lt;/li&gt;
    &lt;li&gt;4&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
