<input type="checkbox" name="hoge" value="ほげ" onchange="onChangeGetCheckBox()" /> <input type="checkbox" name="hoge" value="ふが" onchange="onChangeGetCheckBox()" /> <input type="checkbox" name="hoge" value="ぴよ" onchange="onChangeGetCheckBox()" />
function onChangeGetCheckBox() { let elems = document.getElementsByName('hoge'); for (let i = 0; i < elems.length; i++) { if (elems[i].checked === true) { alert (elems[i].value); } } }