I thought it would be as simple as this…
$('#yourSelect').change(function () {
if ($(this).val() == '12500', '8500', '7000') {
$("#textBox").html("+ £10 delivery");
} else {
$("#textBox").html("+ £6 delivery");
}
});
FRONT
<select name="Amount" id="yourSelect">
<option value="5000">5000</option>
<option value="6000">6000</option>
<option value="7000">7000</option>
<option value="8500">8500</option>
<option value="12500">12500</option>
</select>
<div id="textBox">+ £6 delivery</div>
have i lost my mind? whats wrong here?
Instead of
if ($(this).val() == '12500', '8500', '7000') {you need to use the||operator:As commented by @hafichuk, you can parse the value to a number and use a simpler condition:
You could make it even simpler with: