0

Although var $j = jQuery.noConflict(); is included in the head, installing new module can make js problem in other 3rd-party module. How to avoid this?

1 Answer 1

2

First, you should make sure that you have connected only one jQuery library, because third-party modules usually connects their own jQuery library, which is not necessary.

Second, if you are using the expression

var $j = jQuery.noConflict();

you need to make sure that all the modules are using alias $j instead of $ to call jQuery. I would recommend you to use more simple structure after connecting jQuery library: $.noConflict(); and use alias $.

2
  • Considering the code in ../d1/search.phtml---> <input name="shipping_method" type="radio" value="itellaSmartPost" id="s_method_itellaSmartPost"<?php if("itellaSmartPost"===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/> and the code in /d1/search/result.phtm --> function updatePointValue(e) { var pointValue = $('smartpost_select_point').getValue(); $(s_method_itellaSmartPost).value = pointValue; ....still I get the error undefind varibale for "s_method_itellaSmartPost" in IE ! Do you think it's due to conflict issu?
    – Zinat
    Apr 15, 2016 at 10:46
  • @Zinat We believe that it isn't connected with jQuery conflict, if you don't see this problem in other browsers.
    – Mageworx
    Apr 18, 2016 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.