A jQuery (1.11.1) script has been implemented on a business catalyst site cart page to show or hide a message based on the dropdown option selected by the user. The script functions correctly multiple times in jsfiddle at http://jsfiddle.net/NathanHill/462tk/ but only works once in my browser. Currently, the JavaScript is placed directly after the dropdown in the HTML code.
Unfortunately, I do not have the ability to modify the HTML dropdown to add any functions for onchange events.
Here is the HTML code:
<select onchange="SomeBCfunction(a,b,c);" id="shippingCountry">
<option value="AF">AFGHANISTAN</option>
<option value="AX">ALAND ISLANDS</option>
<option value="GB" selected="selected">UNITED KINGDOM</option>
</select>
<div id="zones">Show message</div>
And here is the JavaScript code:
<script type="text/javascript">
$(document).ready(function(){
$('#shippingCountry').on('change', function() {
if ( this.value == 'GB')
{
$("#zones").show();
}
else
{
$("#zones").hide();
}
});
});
</script>
Any assistance on this matter would be greatly appreciated.
I attempted to modify the existing BC function that is triggered by using the following code:
var SomeBCfunction = oldBCfunction
Function SomeBCfunction (){
//my hide-display code
oldBCfunction;
}
However, I did not make any progress with this approach...