0
I am developing an application with ES6 and doing the build with Webpack. This application will be in a template that already imports jQuery via <script src...></script>
.
How would I import, from this file, the jQuery to use it in my application? I have tried to use the $ of jQuery in the application but gives error:
$ is not defined
But I can’t take this import off the template because it’s shared by other applications.
In HTML I have the following code snippet:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
My Javascript:
class Products {
constructor() {
this.item = $('.prodcut-item')
}
}
From what I understand,
Jquery
inside a fileES6
, right? If that’s it, how are you doing? Please make it easy to help you. If possible, post how are you performing theJquery
.– Jorge.M
Maybe if you show your code we can understand more than if you try to explain
– user38174
window.jQuery
should work.– bfavaretto