hyperform
Version:
Capture form validation back from the browser
17 lines (14 loc) • 346 B
JavaScript
;
/**
* get all radio buttons (including `element`) that belong to element's
* radio group
*/
export function get_radiogroup(element) {
if (element.form) {
return Array.prototype.filter.call(
element.form.elements,
radio => radio.type === 'radio' && radio.name === element.name
);
}
return [element];
}