Search code examples
ajaxradio-buttonresponse

Select a Radio Button in Ajax Response


I have an ajax response that replaces the contents in a div. The response is this:

<input onchange="switch(this.value)" value="val" id="code" checked="checked" type="radio" name="code" />

The radio button shows up just fine, however, it is not checked. Any ideas why?


Solution

  • It's a radio button, not a checkbox and maybe another radio button in the same group (i.e. with the same 'name') is already checked.