$(document).ready(function(){ // Show the first modal on page load $('#myModal').modal('show'); // When the first modal is hidden, show the second modal $('#myModal').on('hidden.bs.modal', function () { $('#myModal2').modal('show'); }); // Close button logic $(".close").click(function() { $(this).closest(".modal").modal("hide"); }); });