Reputation: 61
I am trying to popup a modal on the click of a button, the modal plugin is called iziModal. I am doing this inside of a WordPress page, after the page loads it works on the first try but when I close the modal and click the button again the modal does not pop out but the alert function works Here is my code below
jQuery(document).on('click', '.modal-btn', function (event) {
event.preventDefault();
alert("Am here");
$mentorId = jQuery(this).attr('data-id');
jQuery('input[name="mentorId"]').val($mentorId);
jQuery("#modal-popup").iziModal('open');
});
jQuery(document).on('closing', '#modal-popup', function (e) {
jQuery('#modal-popup').hide();
jQuery('.iziModal-overlay').hide();
});
Upvotes: 1
Views: 122
Reputation: 700
try this code
jQuery(document).on('closing', '#modal-popup', function (e) {
$('#modal-popup').iziModal('close');
});
Upvotes: 1