07-24-2023, 01:59 AM
I want the submit button to act on the combined values in the two didferent dropwdown menu's in the form.
For example... west and winter is a different URL then west and summer
I'm struggeling for days to make this work. I feel some how this must be possible. Please help!
This is the code I use. When I replace the value to a URL. The URL will be loaded on submit (go). I want the values of the first dropdown and second dropdown to be counted and the result should be a URL on submit. Finaly there should be 16 different URLs.
<!-- begin snippet: js hide: false -->
<!-- language: lang-js -->
$(document).ready(function () {
$(".go-btn").click(function () {
location = $("#selection option:selected").val();
});
});
<!-- language: lang-html -->
<div class="selCont">
<h2>pick an option</h2>
<select id="selection" name="selection">
<option value="1">West</option>
<option value="2">East</option>
<option value="3">North</option>
<option value="4">South</option>
</select>
<select id="selection" name="selection">
<option value="1">Winter</option>
<option value="2">Spring</option>
<option value="3">Summer</option>
<option value="4">Fall</option>
</select>
<button class="go-btn" type="submit">Go</button>
</div>
<!-- end snippet -->
For example... west and winter is a different URL then west and summer
I'm struggeling for days to make this work. I feel some how this must be possible. Please help!
This is the code I use. When I replace the value to a URL. The URL will be loaded on submit (go). I want the values of the first dropdown and second dropdown to be counted and the result should be a URL on submit. Finaly there should be 16 different URLs.
<!-- begin snippet: js hide: false -->
<!-- language: lang-js -->
$(document).ready(function () {
$(".go-btn").click(function () {
location = $("#selection option:selected").val();
});
});
<!-- language: lang-html -->
<div class="selCont">
<h2>pick an option</h2>
<select id="selection" name="selection">
<option value="1">West</option>
<option value="2">East</option>
<option value="3">North</option>
<option value="4">South</option>
</select>
<select id="selection" name="selection">
<option value="1">Winter</option>
<option value="2">Spring</option>
<option value="3">Summer</option>
<option value="4">Fall</option>
</select>
<button class="go-btn" type="submit">Go</button>
</div>
<!-- end snippet -->