How to Use jQuery Library in Magento 2?

  • author-img Nidhi Arora
  • 5 years
How to Use jQuery Library in Magento 2-

Magento 2 comes with a lot of built-in by-default features. Although, there is always a need to include jQuery while creating a Magento 2 theme as it facilitates a dynamic & interactive front-end. Require JS enhances performance by enabling javascript to get loaded in the background similar to Lazy javascript loading.

To add jQuery library in Magento 2, you need to include the jQuery code inside require:

<script type=”text/javascript”>


    require([‘jquery’],function($ ){











It is the most recommended way and the best practice to use jQuery library in Magento 2. Share your feedback & queries and also let us know if you need any assistance along the way.

Download Blog


Ready to Get started

Communication is the key for us to understand each other. Allow us to understand
your requirements or queries. Present us with an opportunity to serve you.

Fill out the form and out team will get back to you
within 24 hours

    Head Office

    1250 Pittsford Victor Road Ste 310
    Pittsford, NY 14534

    Development Center

    Plot no. 10, Rajiv Gandhi
    Chandigarh Technology Park