I tried to use jQuery in a template (app\code\Black\Newsletter2Go\view\frontend\templates\account\dashboard\info.phtml) but I get jQuery is not defined.

Does Magento 2 not use jQuery?

Do I have to add:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

to the head template?

1 Answer 1


No need to add jquery in head, You can add like below method in phtml

    ],function($) {
         $(document).ready(function() {
            /* Your logic */
  • But this does use jquery 1
    – Black
    Mar 30, 2021 at 18:35

Your Answer

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

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