0

I am opening a modal window in bootstrap and would like to display alert window immediately after the modal window is opened. I have a working code in jquery, but I would really like to know why my pure javascript equivalent is not working.

Working Jquery code:

$('#mapmodals').on('shown.bs.modal', function () {
      alert("modal opened!");
  });

My javascript equivalent:

var modalWin = document.getElementById("mapmodals");

    modalWin.addEventListener("shown.bs.modal", function() {
      alert("model opened!");
    })

For some reason javascript code is not working while jquery is. Any explanation why it happens?

Thanks!

Andrej
  • 1
  • 1

0 Answers0