Preventing modal closure on outside jQuery click

Upon opening the modal, a div named lean_overlay is generated, which is positioned on top of the HTML page to produce a pleasant effect that enables users to view the HTML page in the background. Since the modal is situated within the div container, you must associate a click event solely for the modal to make it clickable. That concludes the process.


Solution:

Can you consider incorporating an additional section that is “greyed out” beneath the modal?

with the css

#greyedArea {
 background: black;
 opacity:0.25;
 width: 100%;
}

You can utilize it to initiate the process of shutting down.

$('#greyedArea').on('click', function() {
 $('#messages-overlay').hide();
 $('#modal-messages').hide();
});

Frequently Asked Questions