I use the lightcase plugin for modal windows. When I click on a particular button, a window pops up. The plugin inserts a specific layout at the end of the body , which appears only after clicking on the button, i.e. A modal window appears. I want to make my button close the modal window. For this, I hang up the click event handler for this button in $(document).ready(...) , but the click event of the button does not work even if a modal window is open. How do I declare an event handler in this case?
This code is inserted into the contents of the modal window:
<div class="edit editUserName"> ... <div class="popup" id="editNamePopup"> <form> ... </form> <div class="close"> </div> ...
<script> $(document).ready(function(){ $('.editUserName').click(function(){ lightcase.start(); }); $('.popup .close').click(function(){ //Вот эта функция и не выполняется }) }) <script>