Better jQuery code to select a radio button if none are selected?
<p>I have this code, which works fine:</p>

<pre><code>if ( $('table#attribute_Size input.quantitycheckbox:checked').length == 0 )
    $('table#attribute_Size input.quantitycheckbox:first').attr({ checked: true });
</code></pre>

<p>As you can see though, it's pretty long and most of the selector is repeated. Is there a neat was to shorten it? I tried this but it doesn't work (I assume it's looking at nested elements instead of the current selector).</p>

<pre><code>var $sizeRadios = $('table#attribute_Size input.quantitycheckbox');
if ( $(':checked', $sizeRadios).length == 0 )
    $(':first', $sizeRadios).attr({ checked: true });
</code></pre>
