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" />
开发者_C百科
The radio button shows up just fine, however, it is not checked. Any ideas why?
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.
There is no need to write any code for onclick. The default behavior of radio button is to change its state on click. Also value='val'
attribute. I guess it's messing up with checked attribute.
精彩评论