I encounter a very strange issue here.
I have two select fields that will output show same result if one of them changes selected value.
Here's the code:
var qlt,internalQ;
if (jQuery("#qlt").length>0){
qlt = (jQuery("#qlt").val()).split(":")[0];
qltDesc = (jQuery("#qlt").val()).split(":")[1];
}
if (jQuery("#internalQ").length>0){
internalQ = (jQuery("#internalQ").val()).split(":")[0];
qltDesc = (jQuery("#internalQ").val()).split(":")[1];
}
<?php if(is_single('booklets')) { ?>
jQuery('#qlt').change(function(){
if (qlt=="4-1") { jQuery('#internalQ').val('4-1:Matt 90gsm'); }
else if(qlt=="4-2") { jQuery('#internalQ').val('4-2:Silk/matt 128gsm'); }
else if(qlt=="4-3") { jQuery('#internalQ').val('4-3:Silk/Matt 150gsm'); }
calculate();
});
jQuery('#internalQ').change(function(){
if (internalQ=="4-1") { jQuery('#qlt').val('4-1:Matt 90gsm'); }
else if(internalQ=="4-2") { jQuery('#qlt').val('4-2:Silk/matt 128gsm'); }
else if(internalQ=="4-3") { jQuery('#qlt').val('4-3:Silk/Matt 150gsm'); }
calculate();
});
<?php } ?>
The problem is the last conditions of each JQuery.change function (else if(internalQ=="4-3"
and else if(qlt=="4-3")
) does not work as expected. The value will change back to the first option, NOt the third.
If my description is not clear, my current page is: http://210.48.94.218/~printabl/products/booklets/
The fields I'm talking about are Cover Quality
and Internal Quality
Q: Did I miss something here? Can you point it out? Any help will be greatly appreciated.