Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-confirm-modal: The bootstrap modal plugin does not appear to be loaded #93

Closed
Bodata opened this issue Aug 25, 2021 · 4 comments
Closed

Comments

@Bodata
Copy link

Bodata commented Aug 25, 2021

I asked this question on stackoverflow... but perhaps the question better should be asked here.

I have been at this for a day now, i seem to be running in circels.

Rails 6 project with webpacker using bootstrap and jquery

ruby 2.7.4
rails 6.0.4.1
jquery 3.6.0
bootstrap 5.1.0
and data-confirm-modal 1.6.2

When the page loads the chrome debugger tells me: Uncaught Error: The bootstrap modal plugin does not appear to be loaded.

  if ($.fn.modal == undefined) {
    throw new Error("The bootstrap modal plugin does not appear to be loaded.");
  }

Jquery is working.
Also i can see $ and $.fn are defined.
modal is missing from the properties of $.fn

enviroment.js

const { environment } = require('@rails/webpacker')

const webpack = require('webpack')
environment.plugins.prepend('Provide',
    new webpack.ProvidePlugin({
      $: 'jquery/src/jquery',
      jQuery: 'jquery/src/jquery'
    })
)

module.exports = environment

application.js

require("@rails/ujs").start()
//require("turbolinks").start()  // gave reload bug... remove ?
require("@rails/activestorage").start()
require("channels")
//require("local-time").start()
require('jquery')

//import "./gems.js.erb"  # needs bundle exec rails webpacker:install:erb !
//import "./direct_uploads"

require('jquery-ui')

require('bootstrap')

window.jQuery = $;
window.$ = $;

import 'data-confirm-modal'

What am i missing ?

@tagliala
Copy link
Member

Hi, data-confirm-modal does not support Bootstrap 5

Please check #83, you will find a workaround

Hope it helps

Closing here

@Bodata
Copy link
Author

Bodata commented Aug 25, 2021

Ok.. that was quick ;-) Thanks.

So if i downgrade to bootstrap 4 this problem should disapear ?
The jquery 3.6.0 is ok our should i downgrade also ?

regards,
Peter

@tagliala
Copy link
Member

So if i downgrade to bootstrap 4 this problem should disapear ?

BS4 should work. Otherwise you can use the experimental and unsupported file linked in #83

The jquery 3.6.0 is ok our should i downgrade also ?

jQuery should not be an issue for data-confirm-modal

@abartov
Copy link

abartov commented Mar 8, 2024

(I get this error with Bootstrap 4.2.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants