Skip to content
Advertisement

Problem with loading modal in bulma with Laravel

I have a link on one page that goes to another route where when clicked I want to open modal. I am using bulma with Laravel. Currently when clicked it goes to that route and it shows plain html and not modal as it is supposed to. Any help is appreciated. Here is my code.

index.blade.php

JavaScript

privacy-policy.blade.php

JavaScript

Advertisement

Answer

I see multiple issues with your code samples

  1. References – In the below code you want to launch the element with an ID launchModal but your button does not have an ID
JavaScript
  1. Swap the headers and JS Add the JS and Imports to Index

  2. Include the modal

So your Code should be like this

index.blade.php

JavaScript

Privacy-policy.blade.php

JavaScript

I assume the privacy policy is static. If not you would need to use Ajax to load content to the Model

Whenever there’s an href attribute HTML will redirect to the specified path. It’s the expected behaviour unless of course, you use some javascript.

All the best

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement