I am trying to force a user to select a radio option on a page, but when the user checks the ‘No’ option, my .checked value is coming up false.
var long = document.getElementById('long');
if(long.checked == false){
message += '- Please select your stance\\r\\n';
errors = true;
}
<input name='long' id='long' type='radio' value='Yes' >Yes
<input name='long' id='long' type='radio' value='No' >No
Both of your inputs have an id of “long”, so getElementById is probably returning the first one, which is the “Yes” button.