Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery disable SELECT options based on Radio selected (Need support for all browsers)
    text
    copied!<p>Okay having a bit of trouble here, wanted to disable some of the options when selecting a radio. When ABC is selected disable the 1,2 &amp; 3 options, etc...</p> <pre><code>$("input:radio[@name='abc123']").click(function() { if($(this).val() == 'abc') { // Disable $("'theOptions' option[value='1']").attr("disabled","disabled"); $("'theOptions' option[value='2']").attr("disabled","disabled"); $("'theOptions' option[value='3']").attr("disabled","disabled"); } else { // Disbale abc's } }); ABC: &lt;input type="radio" name="abc123" id="abc"/&gt; 123: &lt;input type="radio" name="abc123" id="123"/&gt; &lt;select id="theOptions"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="a"&gt;a&lt;/option&gt; &lt;option value="b"&gt;b&lt;/option&gt; &lt;option value="c"&gt;c&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Not working any ideas?</p> <p>UPDATE:</p> <p>Ok I got the enable/disable working but a new problem has arose. The disabled options for my select box only work in FF and IE8. I have tested IE6 and the disabled is not working. I have tried to use the hide() and show() with no luck either. basically I need to hide/disable/remove the options (for all browsers) and be able to add them back if the other radio option is selected and vice versa.</p> <p>CONCLUSION:</p> <p>Thanks for all the solutions, most of all of them answered my original question. Much PROPS to all :)</p>
 

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