how to select list-items having index value within a certain range?
<p>I want to assign a class to the list-items of an <code>ul li</code> list having <code>.index()</code> value between 10 to 20.</p>

<p>How do I select those elements using jQuery?</p>

<pre><code>&lt;ul&gt;
    &lt;li&gt;One&lt;/li&gt;
    &lt;li&gt;Two&lt;/li&gt;
    &lt;li&gt;Three&lt;/li&gt;
    ...
    ...
    ...
    ...
    li&gt;Thirty&lt;/li&gt;
&lt;/ul&gt;
</code></pre>

<p>So I want something like</p>

<pre><code>$('#id').click(function(){
    //Assign class 'classname' to those li elements 
    //between 10th and 20th (index numbers) in the list
    if([li element's index is between 10 and 20]).addClass('classname');
});
</code></pre>
