I share the concerns of Andries but I think there are valid reasons to use jQuery, for example when you want to use a library with jQuery dependencies.
Back to the question, you can find some widgets in the app store that use jQuery. I suggest to copy the code from them. See the HTML widget - https://github.com/mendix/HTMLSnippet/blob/master/src/HTMLSnippet/widget/HTMLSnippet.js
I extracted the following snippet on how to load jQuery from a lib folder in the widget.
require(["HTMLSnippet/lib/jquery-3.3.1"], lang.hitch(this, function (jquery_3_3_1) {
//do something with jQuery
}));
-Andrej
Recommended not to use jQuery at all.
- Size, of unused code
- Possible conflict between widgets libs
- All function for jQuery could be implemented with JavaScript in modern browsers
Thanks for everyone's suggestions.
I think I will try to workaround with Javascript.
But how do I make my Javascript act like jQuery that works in real-time ?
Like if I resize my window... do function...
Thanks again !