2

I am using below code in my phtml file. enter image description here

Afte using below code:

province drop down is not showing. enter image description here

  • Do you see any errors in the console? The problem most likely is in the fact that magento comes with jquery library already so your injection outside the requirejs ecosystem may mess something there. Check magento devdocs (devdocs.magento.com/guides/v2.1/javascript-dev-guide/…) to learn the proper way to add custom js scripts. – Zefiryn Feb 21 at 22:06
  • In Magento 2 we are already having the jquery then why you are invoking it from the external link? – ABHISHEK TRIPATHI Feb 28 at 10:57
1

jQuery should have been loaded by Magento 2 by default.

You should be able to do this:

<script>
    require([
        'jquery'
    ], function($){
        $(document).ready( function() {
            $("#btn_checkall").click(function(){
               //your code
            });
        });
    });
</script>

As you can see no need to add another jQuery, you are simply calling Magento 2 loaded jQuery.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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