Bootstrap Modal

I’m sure this is an easy solution but for some reason when I create a modal in my index page and create a button to open it, nothing happens. Is there a trick to getting modal to open in the coldbox architecture?

Thank you,

Rick

Not really, ColdBox is server side and bootstrap is client side. Usually, the biggest issue people have is the loading of assets (css, js, etc.) What version of bootstrap are you using?

Maybe verify a few things:

  1. Verify Bootstrap CSS and JS are loading ok
  2. Verify jQuery is loading ok
  3. Open developer tools and try to open the modal with jQuery from the console.
$('#myModal').modal('show');

Thank you so much. All I did was change the example name of the modal to myModal so I could use your script in the console and it worked so I changed the button name and now it works? Not sure why it didn’t earlier, I used the example code from bootstrap?

Works now!!! Thank you so much!!!

Rick

No problem @SixGuns , glad it’s working for you.

One other thing to check are the attributes. I know they changed between Bootstrap 4 and Bootstrap 5 so make sure you’re using the right attributes to match the bootstrap version you are using.

Bootstrap 4: https://getbootstrap.com/docs/4.0/components/modal/

data-toggle="modal" data-target="#myModal"

Bootstrap 5: https://getbootstrap.com/docs/5.3/components/modal/#how-it-works

data-bs-toggle="modal" data-bs-target="#myModal"