TypeError: $(...).toast is not a function #1570
-
I'm using Meteor 1.9.2 with Semantic-UI-react 0.88.2.
When I try to execute: $('body')
.toast({
title: 'LOOK',
message: 'See, how long i will last',
showProgress: 'bottom'
})
; I get Thank you for any ideas you might have. The Fomantic-UI package looks awesome. Thanks for doing this!!! |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
I see you are loading CSS only, that's a custom jQuery function. If you are using Semantic-UI-Ract, try to look to they documentation, or load jQuery on page and all fomantic JavaScript files you need |
Beta Was this translation helpful? Give feedback.
-
The toast module is not covered by SUI React, so, as @TheJltres suggested, import jquery, then your above mentioned code should work |
Beta Was this translation helpful? Give feedback.
-
@TheJltres and @lubber-de Thank you! I'm sorry for my ignorance on this, but jQuery is already in my Meteor project. I have no problems using jQuery to reference the body with |
Beta Was this translation helpful? Give feedback.
-
Is jquery imported , thus available, before the |
Beta Was this translation helpful? Give feedback.
-
Yes, in fact I added the |
Beta Was this translation helpful? Give feedback.
-
🤔 Of course you also need to include the |
Beta Was this translation helpful? Give feedback.
-
To include the toast.js I would use some version of |
Beta Was this translation helpful? Give feedback.
-
yes, this file is needed https://github.com/fomantic/Fomantic-UI-CSS/blob/master/components/toast.js |
Beta Was this translation helpful? Give feedback.
-
Most probably also the |
Beta Was this translation helpful? Give feedback.
-
Thanks I'll give it a shot. |
Beta Was this translation helpful? Give feedback.
-
It worked, so for anyone using Meteor, in your client startup, import '/node_modules/fomantic-ui-css/components/toast.js';
import '/node_modules/fomantic-ui-css/components/transition.js'; Solved my problem. You can then use |
Beta Was this translation helpful? Give feedback.
It worked, so for anyone using Meteor, in your client startup,
Solved my problem. You can then use
$(...).toast(...)
Thank you @lubber-de and @TheJltres!