How to check with javascript if a drop down has 2 or more options to select?
<p>I have a text box that is already showing, but I also have a select box where the user can select a building, and it will show another select box with more options depending on which building the user chose. The second select box always has the option <code>new</code></p>

<p>My problem is that if the user selects a certain building from the select box, the program has to check if the building has more options besides from the <code>new</code>option, and if it has, then the text box should disappear, but if the building only has the <code>new</code> option, then the textbox must stay there, and the second select box needs to disappear.</p>

<p>I tried using something like:</p>

<pre><code>if (secondbox.length==1){
secondbox.style.display='none'}
</code></pre>

<p>but it works after I changed to another building instead of working instantly.</p>

<p>Javascript:
    if (comm.length == 1){
        comm.style.display='none';
        comm.disabled=true;
        comm.value='';
        comm.style.visibility='hidden';</p>

<pre><code>    textNumber.style.visibility='visible';
    textNumber.disabled=false;
    textNumber.focus();

    textic.style.visibility='hidden';
    textic.disabled=true;
    textic.value='';

    document.getElementById('btnComm').value='Add';}
else {
    comm.style.display='';
    comm.disabled=false;
    comm.style.visibility='visible';

    textNumber.style.visibility='hidden';
    textNumber.disabled=true;
    textNumber.value='';

    textic.style.visibility='hidden';
    textic.disabled=true;
    textic.value='';

    document.getElementById('btnComm').value='Update';}
</code></pre>

<p>}</p>
