Created
August 22, 2019 11:49
-
-
Save IgorMiroshin/d444cdfcda8f8b928c732098e7ec1685 to your computer and use it in GitHub Desktop.
JQuery: closes the modal by clicking outside it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).mouseup(function (e){ // событие клика по веб-документу | |
var div = $(".item-treatment_program_modal .bigform"); // тут указываем ID элемента | |
var parentdiv = $(".item-treatment_program_modal"); // тут указываем ID элемента | |
if (!div.is(e.target) // если клик был не по нашему блоку | |
&& div.has(e.target).length === 0) { // и не по его дочерним элементам | |
parentdiv.hide(); // скрываем его | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment