If you're sure that your users are using up-to-date browsers, which support the DOM document.querySelector()
method, you can use:
document.querySelector('input[type="radio"]:checked').checked = false;
JS Fiddle demo.
The benefit of querySelector()
is that it returns only the first element that matches the selector pattern (assuming it matches any element) (though if you want to get all the matching elements there's document.querySelectorAll()
).
The document
can, of course, be replaced with am element-node reference (to restrict the method to searching only the form, for example, rather than the whole document).
References: