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?
You can set your jquery inside Block PHP file,
$customJs = "
By default jQuery is always there and added in magento platform.
However if you would like to use the jQuery in the Block file, then you must require to load jQuery in the block file, using below code you will able to load and put the js code on JS event :
$YourJsName = "
Note : Just one suggestion , jQuery always needs to use in view(phtml) file, if you don't have strict complex logic , then try to load and use it in the phtml file only.
Hope it helps