I'm working on a form that checks which option in <select>
element is selected and then redirect to a page after button is clicked.
I've tried from jQuery get value of select onChange, but it only helps when option is selected immediately.
function getval() {
if (sel.value == "2") {
window.location.href = "payment1.html";
} else if (sel.value == "3") {
window.location.href = "payment2.html";
}
}
<select id="payment-select">
<option value="1">Select payment option</option>
<option value="2">Payment1</option>
<option value="3">Payment2</option>
</select>
<br>
<input type="button" onclick="getval()" class="button" value="Continue">
How would I connect this script to my <input type="button" onclick="getval()" class="button" value="Continue">
?