Right I have a jQuery function which I am struggling to get working. There is a Select drop down menu, when the "Fat Quarter" is selected, I want it to half the value "a" in the jQuery function below
HTML:
<select data-unit="m" data-common-unit="m" name="length_needed" id="length_needed" class="amount_needed">
<option value="0.500">Fat Quarter</option>
<option value="0.25"> 1/4m</option>
<option value="0.5"> 1/2m</option>
<option value="0.75"> 3/4m</option>
<option value="1"> 1m</option>
</select>
jQuery:
jQuery(document).ready(function(a) {
function g(a) {
var b = "",
d = decimals,
e = pos,
f = symbol;
switch (.....) {
case "left":
if ("input.amount_needed".value == "Fat Quarter"){
b = '<span class="amount">' + f + a/2 + "</span>";
}else{
b = '<span class="amount">' + f + a + "</span>";
}
break;
...
}
}
Basically the if statement is at fault somewhere, and I cannot figure it out - it shows the price at full (not divided by 2).
Full code can be seen here: https://jsfiddle.net/avfsdL9x/
It works fine without the if statement in place - it is a mixture of html, php, jquery, but I cannot put all the PHP in as its split across 100s of files.