Note that there are some explanatory texts on larger screens.

plurals
  1. POEnable a button if value is entered in a textbox of selected radio button
    primarykey
    data
    text
    <p>I have three radio buttons which are three options, on selecting, their sub-options will be displayed. The next button should be enabled when some text is entered in the currently selected option's sub-option text box. Entering all sub-options under an option is a must. So i want to enable the next button if values are entered in all text boxes under a selected option and are of some <b> minimum defined length</b>. How can i do this?</p> <p>Here is the jsfiddle link:<b><i> <a href="http://jsfiddle.net/yYJQY/2/" rel="nofollow">http://jsfiddle.net/yYJQY/2/</a> </i></b></p> <p>My code:</p> <pre><code>&lt;div&gt; &lt;input type="radio" value="1" name="options" /&gt;Option1 &lt;input type="radio" value="2" name="options" /&gt;Option2 &lt;input type="radio" value="3" name="options" /&gt;Option3 &lt;/div&gt; &lt;div id="option1" style="display: none;"&gt; &lt;label&gt;Enter Value:&lt;/label&gt;&lt;input type="text" name="value_option1" /&gt; &lt;/div&gt; &lt;div id="option2" style="display: none;"&gt; &lt;label&gt;Enter value1:&lt;/label&gt;&lt;input type="text" name="value_option2_1" /&gt;&lt;br /&gt; &lt;label&gt;Enter value2:&lt;/label&gt;&lt;input type="text" name="value_option2_2" /&gt; &lt;/div&gt; &lt;div id="option3" style="display: none;"&gt; &lt;label&gt;Select a number:&lt;/label&gt; &lt;select name="quantity" id="number"&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;/select&gt; &lt;br /&gt; &lt;input type="text" id="val1" /&gt; &lt;br /&gt; &lt;input type="text" id="val2" /&gt; &lt;br /&gt; &lt;input type="text" id="val3" /&gt; &lt;br /&gt; &lt;/div&gt; &lt;button disabled&gt;NEXT&lt;/button&gt; </code></pre> <p>My Script:</p> <pre><code>$(document).ready(function () { $('input[name=options]').bind('change' ,function() { if($(this).val() == '1') { $('#option1').show(); $('#option2').hide(); $('#option3').hide(); } if($(this).val() == '2') { $('#option2').show(); $('#option1').hide(); $('#option3').hide(); } if($(this).val() == '3') { $('#option2').hide(); $('#option1').hide(); $('#option3').show(); } }) $('#val2').hide(); $('#val3').hide(); $('#number').bind('change', function() { if($(this).val() == '1') { $('#val1').show(); $('#val2').hide(); $('#val3').hide(); } if($(this).val() == '2') { $('#val1').show(); $('#val2').show(); $('#val3').hide(); } if($(this).val() == '3') { $('#val1').show(); $('#val2').show(); $('#val3').show(); } }) }) </code></pre> <p>Any help is appreciated. Thank you!!</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