Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Like I told you in the comment, you need to change the ID in the "getElementById".</p> <p>I also add the re-enabled the field when the other one is empty.</p> <p>I add an empty value in the select, when the null is selected, the zip code's field return enable.</p> <p><strong>HTML</strong></p> <pre><code>&lt;ul class="tabs"&gt; &lt;li&gt;&lt;a class="border-radius top med" href="#city"&gt;City&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="border-radius top med" href="#zipcode"&gt;Zipcode&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="city"&gt;&lt;label class="IDX-advancedText"&gt;City&lt;/label&gt; &lt;select id="aht-home-city" name="city[]" class="IDX-select " autocomplete="off"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="2115"&gt;Austin&lt;/option&gt; &lt;option value="2718"&gt;Bartlett&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;div id="zipcode"&gt;&lt;label class="IDX-advancedText"&gt;Zipcode&lt;/label&gt; &lt;input class="IDX-advancedBox IDX-advWildText" id="IDX-aw_zipcode" type="text" maxlength="255" name="aw_zipcode" value="" /&gt;&lt;/div&gt; </code></pre> <p><strong>Javascript :</strong> </p> <pre><code>var dis1 = document.getElementById("aht-home-city"); var dis2 = document.getElementById("IDX-aw_zipcode"); dis1.onchange = function () { if (dis1.value !== "" || dis1.value.length &gt; 0) { dis2.disabled = true; } else { dis2.disabled = false; } }; dis2.onchange = function () { if (dis2.value !== "" || dis2.value.length &gt; 0) { dis1.disabled = true; } else { dis1.disabled = false; } }; </code></pre> <p>There is a working example : <a href="http://jsbin.com/oqOMoDe/1/edit?html,js,output" rel="nofollow">JSBin Example</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload