I cannot use JQuery for this project.
I am trying to gather 3 variables from 3 radio buttons. The submission of this form will trigger a function that will check the three variables with a simple conditional. This will either run the first line or (else) run the second line of code. I'm having a problem with the conditional (it appears). I always get the first line to fire, never the second line.
function valid() {
var q1 = document.getElementById("ques1").value;
var q2 = document.getElementById("ques2").value;
var q3 = document.getElementById("ques3").value;
if (q1 ==="5" && q2 ==="5" && q3 ==="5" ) {
alert("Thank you for your interest in acme employment. We are not able to consider you for employment at this time. ");
} else {
window.location.assign("http://acmeemployment.com");
//window.location.assign("http://www.w3schools.com");
}
}
<form action="" method="">
<p>Are you 18 years of age or older?*<br/>
<input type="radio" name="q1" id="ques1" value="5">Yes
<br/>
<input type="radio" name="q1" value="7">No
</p>
<p>Are you willing to take a drug screen according to our policy?*<br/>
<input type="radio" name="q2" id="ques2" value="5">Yes
<br/>
<input type="radio" name="q2" value="7">No
</p>
<p>Will you release your background information inclusive of ciminal records?*<br/>
<input type="radio" name="q3" id="ques3" value="5">Yes
<br/>
<input type="radio" name="q3" value="7">No
</p>
<input type="button" value="Submit" onclick="valid()" />
</form>