All threads / Can not use toast of bootstrap in rails

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Can not use toast of bootstrap in rails

Junyao111 asked in Javascript

I did yarn add bootstrap jquery popper.js and import bootstrap into the app.
Also, bootstrap's popover and tooltip style works well.
But when I add a toast in page and run $('div.toast').toast('show') in chrome's console, it says $(...).toast is not a function
Do you know what's wrong?

Sounds like you missed a step. I just updated the repository to include toasts in the example and they work just fine.

https://github.com/gorails-screencasts/bootstap-with-webpack-4/commit/49846a028f0d6674b0024fbd4c1f6051c8757884

Compare your code with the repository and see what you missed.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,665+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.