Simple question I need these few lines of javascript in jquery. Just trying to close a modal when I select outside of it.
Thank you.
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == myModal) {
myModal.style.display = "none";
}
}
I'm assuming the modal is being clicked "myModal" ... so ...
$("#myModal").on("click",function() {
$(this).hide();
});