Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Though Daniel's solution is correct for the most part, it won't work well with ASP.NET. This is due to ASP.NET's mangling of IDs when controls are inside naming containers. Your simplest bet is to add a couple of classes to your controls.</p> <p>Try this:</p> <pre><code>&lt;asp:RadioButtonList ID="Group1Most" CssClass="Group1Most" onClick="disable('Group1Most', 'Group1Least')" runat="server" &gt; &lt;asp:ListItem Value="1"&gt; |&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2"&gt; |&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt; |&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt; |&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;asp:RadioButtonList ID="Group1Least" CssClass="Group1Least" runat="server" &gt; &lt;asp:ListItem Value="1"&gt; This and That&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2"&gt; Fire and Ice&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt; Black and Tan&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt; Smith and Wesson&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>And, because I never advocate writing inline JavaScript, I would put this in an external script file, we'll call it site.js, and reference it from within your page using a script tag, like so:</p> <pre><code>&lt;script type="text/javascript" src="site.js"&gt;&lt;/script&gt; </code></pre> <p>Calling:</p> <pre><code>$(function(){}); </code></pre> <p>is shorthand for :</p> <pre><code>$(document).ready(function(){}); </code></pre> <p>So, this goes inside site.js:</p> <pre><code>$(function() { $('.Group1Most input').click(function() { $('.Group1Least [value=' + $(this).val() + ']').attr('disabled','disabled'); }); }); </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