Clear radio button Javascript

Clear radio button Javascript

If you want to clear radio button javascript or jquery then you don’t need to have unique id for the elements, you can access them by their name attribute:

If you’re using name=”radionButtonName”, then:

With jQuery it is:

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

Javascript:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *