Check if textbox has value then disable form element
<p>If my textbox has text in it, I want to disable the drop down list.  The textbox id is "newAccessPoint" and the drop down list id is "selectAccessPoint"</p>

<p>Jqeury :</p>

<pre><code>if ($.trim($('#newAccessPoint').val()).length() != 0) {
    $('#selectAccessPoint').attr('disabled', 'disabled');
}
</code></pre>

<p>HTML code:
 `</p>

<pre><code>        &lt;tr&gt;
        &lt;td&gt;&lt;label for ="AccessPoint" class="xl"&gt;Access Point:&lt;/label&gt;&lt;/td&gt;
            &lt;td&gt;&lt;%= Html.DropDownListFor(x =&gt; x.AccessPointsList.Id, Model.AccessPointsList.AccessPoints.OrderByDescending(x =&gt; x.Value.AsDecimal()), new { @id = "selectAccessPoint", @class = "info1"})%&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;label for ="AccessPoint" class="xl"&gt;Or Add New:&lt;/label&gt;&lt;/td&gt;
            &lt;td&gt;&lt;%= Html.TextBoxFor(x =&gt; x.AccessPointsList.AccessPoint, new { @id = "newAccessPoint", @class = "location info2 xl", maxlength = "250" }) %&gt;&lt;/td&gt;
        &lt;/tr&gt;
</code></pre>

<p>`</p>
