Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This solution interprets the first option ("-- Select --") as invalid, independent of it's and the other options textual content.</p> <p>Tested with jQuery 1.8.1 and 2.0.3, with browsers Firefox 24.0/Linux, Opera 12.16/Linux, Chrome 29.0.1547.76/Linux.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Option select&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;script type="text/javascript" src="PATH_TO_jQuery"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function bothSelectsAreValid() { return $("#comType")[0].selectedIndex &gt; 0 &amp;&amp; $("#comDirection")[0].selectedIndex &gt; 0; } function setButtonVisibility() { if (bothSelectsAreValid()) $("#button_that_displays_only_when_both_selects_have_input").show(); else $("#button_that_displays_only_when_both_selects_have_input").hide(); } $(document).ready(function() { $("#comType, #comDirection").on('change', function() { setButtonVisibility(); }); setButtonVisibility(); // needed if browser presets the selected values on reload }); &lt;/script&gt; &lt;style type="text/css"&gt; #button_that_displays_only_when_both_selects_have_input { display : none; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;select id="comType"&gt; &lt;option selected="selected"&gt;-- Select --&lt;/option&gt; &lt;option&gt;Call&lt;/option&gt; &lt;option&gt;Fax&lt;/option&gt; &lt;option&gt;Email&lt;/option&gt; &lt;/select&gt; &lt;select id="comDirection"&gt; &lt;option selected="selected"&gt;-- Select --&lt;/option&gt; &lt;option&gt;Incoming&lt;/option&gt; &lt;option&gt;Outgoing&lt;/option&gt; &lt;/select&gt; &lt;a href="#" id="button_that_displays_only_when_both_selects_have_input"&gt;Next&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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