Display div if a specific select option value is selected
<p>I am trying to display a div if user select a specific option value from a select drop down list.</p>

<p>Example:</p>

<p>The select drop down list consist of dynamic names fetched from the database and also one static or permanent name at the bottom of the list called "Admin"</p>

<p>If user select an option that's not "Admin", a div containing certain form element is shown else if the user select "Admin" that div remain hidden</p>

<p>Here is my code:</p>

<p>Javascript -</p>

<pre><code>&lt;script language="javascript"&gt;

function admSelectCheck(nameSelect)
{
    if(nameSelect){
        admOptionValue = document.getElementById("admOption").value;
        if(admOptionValue != 0){
            document.getElementById("admDivCheck").style.display = "";
        }
        else{
            document.getElementById("admDivCheck").style.display = "none";
        }
    }
    else{
        document.getElementById("admDivCheck").style.display = "none";
    }
}

&lt;/script&gt;
</code></pre>

<p>HTML -</p>

<pre><code>&lt;select id="getFname" onchange="admSelectCheck(this.select);"&gt;
&lt;option value="1"&gt;Jay&lt;/option&gt;
&lt;option value="4"&gt;Sam&lt;/option&gt;
&lt;option id="admOption" value="0"&gt;Admin&lt;/option&gt;
&lt;/select&gt;


&lt;div id="admDivCheck" style="display:none;"&gt;
admin selected
&lt;/div&gt;
</code></pre>

<p>Would be glad getting help with this.</p>
