Determine if SelectBox containing no options exists using jQuery
<p>So this question is asked a lot on the net and I see the answer is to check if the .length is > 0.  </p>

<p>So in my case a select box may or may not exist.  If it exists, it may have no options.  </p>

<p>I have to code for the following:</p>

<p>If selectbox exists ...
  if there are no select box options ...
    disable a text area</p>

<p>I have therefore written the following:</p>

<pre><code>$(document).ready(function () {
    "use strict";

    alert('running globals');
    // Only process this block if the contactEmailAddress select box exists
    if ($('contactEmailAddress').length &gt; 0) {
        alert('on the comm page');

        // If there are no contacts ...
        if ($('#contactEmailAddress option').size() === 0) {
            alert('disabling the message box');
            $('#message').attr("disabled", "disabled");
        }
    }
});
</code></pre>

<p>The problem is, because the select box has no options, it's decided the selectbox.length is 0.  So this block never fires.  </p>

<p>I need another way. </p>
