jquery on modal code example

Example 1: onclick open modal jquery

$('#myModal').modal('toggle');
$('#myModal').modal('show');
$('#myModal').modal('hide');

Example 2: call function on modal open

$('#myModal').on('shown.bs.modal', function (e) {
  // do something...
})

Example 3: jquery works until modal is shown

$(document).on('show.bs.modal', '#reservationModal', function (e) {
    console.log('works');
});

Example 4: jquery modal popup

<!-- Modal HTML embedded directly into document -->
<div id="ex1" class="modal">
  <p>Thanks for clicking. That felt good.</p>
  <a href="#" rel="modal:close">Close</a>
</div>

<!-- Link to open the modal -->
<p><a href="#ex1" rel="modal:open">Open Modal</a></p>