Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:50:17+00:00 2026-05-24T00:50:17+00:00

I have an ASP.NET page that’s going to use Html controls to render a

  • 0

I have an ASP.NET page that’s going to use Html controls to render a page like so (sorry, the programmatic rendering is at the office):

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>jQuery Radio Buttons</title>
</head>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<body>
<form id="form1" runat="server">
<div>
    Group 1<br />
    <input type="radio" name="Q1" id="rb1" title="Choice 1" value="false" onclick="javascript:ClickEvent(this);" /><br />
    <input type="radio" name="Q1" id="rb2" title="Choice 2" value="true" onclick="javascript:ClickEvent(this);" /><br />
    <input type="radio" name="Q1" id="rb3" title="Choice 3" value="false" onclick="javascript:ClickEvent(this);" /><br />        
    Group 2<br />
    <input type="radio" name="Q2" id="rb4" title="Choice 1" value="false" onclick="javascript:ClickEvent(this);" /><br />
    <input type="radio" name="Q2" id="rb5" title="Choice 2" value="false" onclick="javascript:ClickEvent(this);" /><br />
    <input type="radio" name="Q2" id="rb6" title="Choice 3" value="true" onclick="javascript:ClickEvent(this);" /><br />
</div>
</form>
</body>
</html>
<script type="text/javascript">
function ClickEvent(r) {

}
</script>

What I need to do in the ClickEvent function is use jQuery to select the group (aka Name). Then if they select the wrong choice (value=”false”) change the radio button’s border to red, and always change the correct answer’s border to green. Then disable the group of buttons.

What would I put in the function definition to accomplish this? I have very little background in jQuery (which I was upfront about, yet was told to use it) but from what I’ve read I think “each” might be the right way to go. I was also told not to bother using CSS classes, just to change the border color. I was able to accomplish this using postbacks but they said it had to be client side. Can anyone help?

p.s. The fact that this is ASP.NET is probably irrelevant. If you know jQuery, please feel free to post an answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:50:18+00:00Added an answer on May 24, 2026 at 12:50 am

    Try this(changed the markup and script to bind the click event in an unobstrusive way):

    <div>
    Group 1<br />
    <input type="radio" name="Q1" id="rb1" title="Choice 1" value="false" /><br />
    <input type="radio" name="Q1" id="rb2" title="Choice 2" value="true" /><br />
    <input type="radio" name="Q1" id="rb3" title="Choice 3" value="false" /><br />        
    Group 2<br />
    <input type="radio" name="Q2" id="rb4" title="Choice 1" value="false" /><br />
    <input type="radio" name="Q2" id="rb5" title="Choice 2" value="false" /><br />
    <input type="radio" name="Q2" id="rb6" title="Choice 3" value="true" /><br />
    </div>
    
    
    <script type="text/javascript"> 
        $(function(){
         $("div :radio").click(ClickEvent);
        });
        function ClickEvent(){
                var el = this;
                var $el = $(el);
                if($el.val() == "false"){
                    var all = $("[name='" + $el.attr("name") + "']");
                    var correctRadio = all.filter("[value='true']");
                    correctRadio.wrap("<span style='border: solid Green 2px'></span>");
                    $el.wrap("<span style='border: solid Red 2px'></span>");
                    all.prop("disabled", true);
                } 
            }
    
    
    </script> 
    

    Working example: http://jsfiddle.net/bJx5y/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some ASP.NET page and webservice WebMethod() methods that I'd like to add
I have an asp.net view/page (dynamic) that is built up of nested Html.RenderPartials. The
I have an ASP.Net page that will be hosted on a couple different servers,
I have an ASP.NET page that uses a repeater nested within another repeater to
I'll have an ASP.net page that creates some Excel Sheets and sends them to
I have an ASP.NET web page that displays a variety of fields that need
I have an ASP.NET page A that uses a data layer assembly DAL .
I have a very simple ASP.Net page that acts as a front end for
I have an ASP.Net 2.0 page that contains two UpdatePanels. The first panel contains
I have a button on an ASP.Net page that will call Response.Redirect back to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.