bootstrap modal open slowly code example

Example 1: open bootstrap modal using javascript

$("#myModal").modal(); //open modal
$('#myModal').modal('toggle'); //open modal
$('#myModal').modal('show'); //open modal
$('#myModal').modal('hide'); //hide modal
//@sujay

Example 2: bootstrap pop modal from another modal

// Hide current modal before opening new one
$("#idModal").modal('hide');
$("#idModal2").modal() // or .modal("show");

// show 1st modal again after closing 2nd modal
$("#idModal2").on('hidden.bs.modal', () => $("#idModal").modal('show'))
// using hide.bs.modal might cause modal to stop scrolling!!!

Tags:

Html Example