jQuery: Match a list with less than X items
<p>I want add a class to lists, but only if they have 3 or less items:</p>

<pre><code>var ol = $('ol');
var len = ol.children('li').length;

//0 based?
while(len &lt; 2) {

    $("ol").addClass("small-list");

}
</code></pre>

<p><a href="http://jsfiddle.net/hryZ4/2/" rel="nofollow">http://jsfiddle.net/hryZ4/2/</a></p>

<p>How would I add such a conditional clause?</p>

<p>All I found was something mroe or less unrelated: <a href="http://stackoverflow.com/questions/2179799/fill-list-up-to-10-items">Fill list up to 10 items</a></p>
