I was trying to check a radio button with jQuery. Here's my code:
<form> 
          <div id='type'> 
                  <input type='radio' id='radio_1' name='type' value='1' /> 
                  <input type='radio' id='radio_2' name='type' value='2' /> 
                  <input type='radio' id='radio_3' name='type' value='3' /> 
            </div> 
</form>
And the JavaScript:
jQuery("#radio_1").attr('checked', true);
Doesn't work:
jQuery("input[value='1']").attr('checked', true);
Doesn't work:
jQuery('input:radio[name="type"]').filter('[value="1"]').attr('checked', true);
Doesn't work:
Does anyone have another idea? I am unable to understand what am I missing?