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

  • SEARCH
  • Home
  • 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 7576635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:58:13+00:00 2026-05-30T16:58:13+00:00

Summary of problem statement : Radio button html on the browser does not display

  • 0

Summary of problem statement: Radio button html on the browser does not display the checked attribute, but Firebug indicates that the radio’s checked attribute is set as checked.

Tested on

Broswer: FF 3.6.18 and IE8
jQuery: 1.5
MVC3 (Razor)

Details

Using MVC3 (with Razor) I’m rendering the following radio buttons from the server. The desired functionality is that on checking one radio, the other should be unchecked and vice-versa. In other words, the user is allowed to only select one option – say val1 or val2.

<div id="myRadioList">
    <div>
        <input type="radio" value="val1" onclick="updateFunctionCalledHere(this)" name="myRadioName" id="myRadioName_val1" checked="checked">
        
    </div>
    <div>
        <input type="radio" value="val2" onclick="updateFunctionCalledHere(this)" name="myRadioName" id="myRadioName_val2">
    </div>
</div>

What I’m observing is that if the user toggles the radio selected, the newly selected radio (let’s say myRadioName_val2) is shown to be checked using firebug but the html still reflects the other radio button as checked. Because of this, some other validations are failing.

I’ve tried literally removing all checked attributes of both the radio buttons and then just check the one that’s clicked.

This is what I’m doing to set the currently clicked radio, that is not working:

$("#myRadioList > div > input[value='myRadioName_val2]').attr('checked', 'checked');

I’m simplifying my code to avoid posting unnecessary details.

  • 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-30T16:58:14+00:00Added an answer on May 30, 2026 at 4:58 pm

    The checked attribute in HTML is the default value.
    The checked property in JavaScript refers to the current state of the radio button.

    Generally, it’s best to let the browser handle the checked state of radio buttons and checkboxes rather than setting it yourself, otherwise you run into these kinds of problems. It’s safe to get the current state via prop("checked") as already suggested, or through .is(":checked").

    You may also want to consider using syntax like $('#myRadioList').find('input[value="myRadioName_val2"]') or better yet, $('#myRadioName_val2'), as child selectors in jQuery can be rather slow, since they are read right to left.

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

Sidebar

Related Questions

Problem Summary When run in batch mode, my user identity is lost but (like
i have this really weired js problem. in summary, i get a element not
Problem summary: I use OpenGL glReadPixels to get a screenshot but the buffer is
Summary of the problem: For some decimal values, when we convert the type from
In summary, I am having a problem where I read what I expect to
Here's my problem: there's an internal issue tracking system that has a nice summary
I am trying to write documentation comments however I have a problem. /// <summary>
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not borrow
Very simple problem...but weird results. Im just trying to fill a drop down list
Here is a test case/live example. Summary of problem: This only works in WebKit:

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.