Answer the question
In order to leave comments, you need to log in
How to close fancybox window on button click?
Greetings!
The site has a modal window in which data is filled in by users. When you click on Send, the data is sent to the mail.
How can I make the modal window close when I click the Submit button?
Answer the question
In order to leave comments, you need to log in
$(document).on('submit', '#your-form', function() {
$.fn.fancybox.close();
});
Or for a button
$(document).on('click', '#your-button', function() {
$.fn.fancybox.close();
});
<a href="javascript:;" onclick="$.fancybox.close();" class="close">Закрыть</a>
<div class="close">Закрыть</div>
$('.close').click(function () {
$.fancybox.close();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question