How to clear radio button in Javascript?

You don’t need to have unique id for the elements, you can access them by their name attribute:

If you’re using name="Choose", then:

With recent jQuery

$('input[name=Choose]').prop('checked',false);

With old jQuery (<1.6)

$('input[name=Choose]').attr('checked',false);

or in pure JavaScript

var ele = document.getElementsByName("Choose");
for(var i=0;i<ele.length;i++)
    ele[i].checked = false;

Demo for JavaScript

Leave a Comment