jeudi 18 juillet 2019

jquery/javascript conflict error, trouble with jquery old version

i need to hide an element when radio button changes, right now its working fine with ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js version, but many other things like slider, checkout, shipping method are disturbed when i include this jquery in my opencart website. any suggestion how i can do that with simple javascript or any other method?

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>
<script type="text/javascript">
    $(document).ready(function() {
     $('input:radio[name=custom_field[6]]').change(function() {
        if (this.value == '2') {
            $('input:radio[name=payment_method][value=cod]').show();
            $('div.checkout-payment-methods div.radio:nth-child(5)').show();
             }
            else if (this.value == '1') {
            $('input:radio[name=payment_method][value=cod]').hide();
            $('div.checkout-payment-methods div.radio:nth-child(5)').hide();
            }
        });
     });
</script>

Aucun commentaire:

Enregistrer un commentaire