You cannot have the same identifier ( #radio1) more than once, use instead class.
$('.radio1').attr('checked', true);
$('.radio2').attr('checked', true);
id should be used once for each element on the page.
If you want to check / uncheck the box click, you can do the following:
$('#someid').click(function(){
$('#radio1').attr('checked', true);
});
or
$('#someid').click(function(){
$('#radio1').attr('checked', this.checked);
});
source
share