Javascript Redirect Based On Option Selected
I need some help with the javascript redirect. I have the following code for the form and it is not working.
Solution 1:
Try this:
functiondirection(value) {
var trade = $("#trade").val();
var questions = $(".questions:checked").val();
if ((trade == "A") && (questions == "y")) {
window.location = "http://localhost:8080/Math/page1.html";
} else {
window.location = "http://localhost:8080/Math/page2.html";
}
}
Demo here
What I added:
var trade = $("#trade").val();
var questions = $(".questions:checked").val();
and removed the duplicate ID and used a class instead:
<INPUT TYPE="radio"class="questions" NAME="questions" VALUE="y"/>Yes
<INPUT TYPE="radio"class="questions" NAME="questions" VALUE="n"/>No
Post a Comment for "Javascript Redirect Based On Option Selected"