I just upgraded from beta1.7 to 1.3. In my main.html
I have a jQuery
and Bootstrapv4
script tag. I have an accordion on which I call $('el').collapse('toggle')
. All of a sudden, I got an error that $(...).collapse is not a function
. Can’t figure out why it would break like that. Using React on the front-end for what it’s worth. Any help is greatly appreciated…
I’m experiencing exactly this. Have a jQuery plugin in client/lib. I get this message in browser console:
Exception from Tracker afterFlush function:
meteor.js?hash=ec96c6f…:913 TypeError: tpl.$(…).selectpicker is not a function
I can see that jQuery has been defined before the code in client/lib/bootstrap-select.js runs.
I had to run
meteor npm install --save jquery
To get jQuery working at all, in case that’s relevant
@jimmytidey this is what I did.
- I went to the bootstrap site and got the js code, copy/pasta into a
third_party/bootstrap/bootstrap.js
file - then I wrap the bootstrap code in a function, and export as a module -
module.exports = bootstrapInit
- then I invoke the function in my main wrapper route (using react-router) in
componentDidMount
-initBootstrap()
That’s very helpful, thanks for letting me know. I’ll confirm if that works for me.
Is that the right solution though? I can’t understand why it doesn’t work as it is? Do they want me to include all external javascript through NPM?
I put jquery plugins and things in "client/compatibility"and it’s working. Not sure if it’s the correct way to fix it.