cancel
Showing results for 
Search instead for 
Did you mean: 

Quick question about JQuery ?

Quick question about JQuery ?

I am trying to use JQuery in my block functions, but I get an error saying JQuery not found. I tried google and some suggested to add it to local.xml but I think Magento2 does not have local.xml.

 

Can anyone help me on how to enable JQuery in Magento2?

 

Thanks

1 REPLY 1

Re: Quick question about JQuery ?

Hi @aquas_askin 

 

If you are adding jQuery direct into block. I will suggest you to add your code inside require. See below code for example.

 

require(['jquery'], function($) {
	// add your code inside this
});

and if you are using any other method. Please let me know.

 

Thanks

--
If my answer is useful, please Accept as Solution & give Kudos