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?


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

    ],function($) {
         $(document).ready(function() {
            /* Your logic */
| improve this answer | |

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.