I have two radio buttons within an HTML form. A dialog box appears when one of the fields is null. How can I check whether a radio button is selected?
This would be valid for radio buttons sharing the same name, no JQuery needed.
var x = Array.prototype.filter.call(document.getElementsByName('checkThing'), function(x) { return x.checked })[0];
If we are talking about checkboxes and we want a list with the checkboxes checked sharing a name:
var x = Array.prototype.filter.call(document.getElementsByName('checkThing'), function(x) { return x.checked });