Disable select if only one option available
<p>Hey so I have this HTML (outputted via PHP loop):</p>

<pre><code>&lt;select class="dropdown" id="pa_genre" name="attribute_pa_genre"&gt;
    &lt;optgroup label="Choose an option:"&gt;&lt;/optgroup&gt;
    &lt;option value="sport" selected="selected"&gt;Sport&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>And this jQuery (taken from <a href="http://stackoverflow.com/questions/5002360/disable-a-select-if-there-is-only-one-option-with-jquery">Disable a &lt;select /&gt; if there is only one &lt;option /&gt; with jQuery</a>):</p>

<pre><code>$(document).ready(function(){
    var $sca = $("select.dropdown");
    if ($sca.find("option").length &lt;= 1) {
        $sca.prop('disabled', true);
    }
});
</code></pre>

<p>But can't get it to work.. I do have more than one dropdown on the page with the same class (hence why targeting the class not id). I changed the <code>attr</code> to <code>prop</code> because I'm sure it's the new version and <code>attr</code> isn't used anymore..</p>
