javascript - Modal backdrop doesn't hide when clicking an element inside it -


on page have modal few <div class="message-container">. if user clicks on element, page sends ajax request new modal. when close new modal, still have backdrop first modal. modals return php. have tried closing old modal before opening new 1 still doesn't help.

here js code:

$(document).on('click', '.message-container', function () {     var messageid = $(this).attr('data-message-id');     $.ajax({         method: "post",         data: {             action: 'readmessage',             messageid: messageid         }     }).done(function (ret) {         var obj = jquery.parsejson(ret);         if (obj.code == 1) {             $('#messages').modal('hide');             $('.modal-container').html('');              $('.modal-container').html(obj.value);             $('#read-message').modal('toggle');         } else {          }     }); });  $(document).on('click', '.unreadedmessages', function () {     $.ajax({         method: "post",         data: {             action: 'getmessages'         }     }).done(function (ret) {         var obj = jquery.parsejson(ret);         if (obj.code == 1) {             $('.modal-container').html(obj.value);             $('#messages').modal('show');         } else {             var content = '<div class="alert alert-danger" id="messages-alert" role="alert">' + obj.value + '</div>';         }     }) }); 

unreadedmessages first.

not sure if need, here css pattern used when have multiple modals open.

body .modalblockout ~ .modalblockout {     opacity: 0 !important; } 

this hide block out elements, , shows first one.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -