Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try adding this jQuery to your page instead. You don't need the disable function that you have written</p> <pre><code> &lt;script type="text/javascript" &gt; $(document).ready(function() { //hook up a click event to all of the inputs in your first group $('input[name="Group1Most"]').click(function() { //identify the value from the checked item in the first group var checkedValue = $('[name="Group1Most"]:checked').val(); //identify the item in the second group and disable it. $('input[name="Group1Least"][value=' + checkedValue + ']').attr('disabled', 'disabled'); }); }); &lt;/script&gt; </code></pre> <p>Assuming the values match, this will work. You would also be able to do it by the index if you wanted to.</p> <p>if you want to only have one item disabled at a time and re-enable a previously disabled item in the second group, include the following line as the first line in the click function. It will remove the disabled attribute from all inputs in the group</p> <pre><code> $('input[name="Group1Least"]').removeAttr("disabled") </code></pre> <p><strong>Edit:</strong></p> <p>In answer to comment from @Majid above, the output of the controls is like this:</p> <pre><code> &lt;table id="Group1Most" border="0" onclick="disable('Group1Most', 'Group1Least')" &gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Most_0" name="Group1Most" value="1" type="radio"&gt;&lt;label for="Group1Most_0"&gt; |&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Most_1" name="Group1Most" value="2" type="radio"&gt;&lt;label for="Group1Most_1"&gt; |&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Most_2" name="Group1Most" value="3" type="radio"&gt;&lt;label for="Group1Most_2"&gt; |&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Most_3" name="Group1Most" value="4" type="radio"&gt;&lt;label for="Group1Most_3"&gt; |&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;table id="Group1Least" border="0"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Least_0" name="Group1Least" value="1" type="radio"&gt;&lt;label for="Group1Least_0"&gt; This and That&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Least_1" name="Group1Least" value="2" type="radio"&gt;&lt;label for="Group1Least_1"&gt; Fire and Ice&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Least_2" name="Group1Least" value="3" type="radio"&gt;&lt;label for="Group1Least_2"&gt; Black and Tan&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;input id="Group1Least_3" name="Group1Least" value="4" type="radio"&gt;&lt;label for="Group1Least_3"&gt; Smith and Wesson&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; </code></pre>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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