I’m using Sage 10 for the very firt time and I really need to use jQuery, but I’m having a hard time trying to use $. It keeps throwing the error
app.js:75 Uncaught (in promise) TypeError: $ is not a function
jquery: ["jQuery", "$"],
But it doesn’t seem to work. The only way I found to make it work is inside the function
but it doesn’t seems the best solution…
Any ideas of what I’m doing wrong?
Howdy! If you’re using jQuery from WordPress core, I believe that it’s expected behavior for only
jQuery to work and not
It seems fine to me, but the best solution is to avoid jQuery at this point. Even if you’ve got other plugins that are adding it as a dep, do you really need to use it yourself? But anyway, if that you’ve got is able to execute as expected, then I’d roll with it!
Thank you for your reply!
I’m trying my best avoiding jQuery so far. I need to do some animation, I never used React and I have no time learning for this project.
Anyway, if I really need jQuery I will use it as it is!
Thank you very much
I wouldn’t suggest replacing jQuery with React, but instead give vanilla JS a shot for most things. Also, take a look at Alpine.js at some point!
Thank you for you sugestion, for the next projects I’ll strongly consider using React. For now maybe I’ll stay with vanilla, I guess Green Sock uses vanilla, so I’m safe.
Thank you very much, it will be really usefull!!!