var obj = document.getElementsByName("adminFlag"); for(var i = 0; i < obj.length; i ++) { if (obj[i].checked) { var type = obj[i].value; } }