rojobo rojobo - 1 year ago 85 Question

Default Radio button not visually checked

I'm building a dynamic list of

inside a

<%= Html.RadioButtonFor(m => m.Gender, m.Value) %>

The dynamic list gets created alright but the first
is NOT VISUALLY checked

What I mean by this is that the circle portion of the
is not filled with the black dot that tells you it's checked.

However, when I inspect the HTML in the browser's dev tools, the attribute checked="checked" is set!

I tried doing a JQUERY onload

$("#yada").attr("checked", "checked");


and NOTHING works!!! The inspector still says the element checked: true but still the little circle does not get the black dot in it UNLESS I manually click it.

I've also tried setting the first radio button like

Html.RadioButtonFor(m=> m.Gender, m.Value, new { checked = "checked"})

Answer Source

Just to give an answer to this question for anyone who encounters a similar issue (without reading the comments):

If you manually set checked to multiple elements in the same radio button group (defined by the name attribute), only the last one will be displayed as checked, but once you click on one manually, it will reset all the checked elements to match your latest selection. See this fiddle ( for an example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download