I have added a jquery (1.11.1) script to a business catalyst site cart page to hide or display a message depending on what dropdown the user clicks. It works multiple times in jsfiddle http://jsfiddle.net/NathanHill/462tk/ but only once in my browser. The javascript is currently placed in line after the drop down.
I do not have control over the html dropdown so I cannot insert any function into the html onchange.
HTML:
<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>
Javascript:
<script type="text/javascript">
$(document).ready(function(){
$('#shippingCountry').on('change', function() {
if ( this.value == 'GB')
{
$("#zones").show();
}
else
{
$("#zones").hide();
}
});
});
</script>
Any help would be appreciated.
I tried to add/append to the existing BC function that is triggered Eg:
var SomeBCfunction = oldBCfunction
Function SomeBCfunction (){
//my hide-display code
oldBCfunction;
}
but got nowhere with this...