Search code examples
javascriptjquerybootstrap-4electronbootstrap-modal

How to display Bootstrap modal in Electron?


Trying to display Bootstrap Modal in electron.

I have installed jquery and bootstrap modules. Then wrote following code in .js file.

const $ = require('jquery');
require('bootstrap');

$(document).ready(() => {
  $('#myModal').modal();
});

Of course, there is Div tag with id=myModal in .html file. However, when running, the following error is displayed.

$(...).modal is not a function.

What is the reason and how to implement it?


Solution

  • Try please your app with this code

    var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
    

    I met Bootstrap modal issue in ElectronJS in before. It was work well with this code.