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?
I used spread operator and some to check least one element in the array passes the test.
I share for whom concern.
var checked = [...document.getElementsByName("gender")].some(c=>c.checked); console.log(checked);