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.
To add jQuery library in Magento 2, you need to include the jQuery code inside require:
require([‘jquery’],function($ ){
$(document).ready(function(){
alert(“hello”);
});
});
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.
require([‘jquery’],function($ ){
$(document).ready(function(){
alert(“hello”);
});
});
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.
- Contact Email
- [email protected]
- Issued By
- Envision eCommerce
- Country
- India
- Categories
- Software · Technology · Web Development
- Last Updated
- March 22, 2021