arrow_back
Back

jQuery snippets: modals, forms, and common DOM patterns

Andrew Dorokhov Andrew Dorokhov schedule 1 min read

How to send a form from a Bootstrap modal window:

$(function () {
    $(".submit-modal-form-button").on('click', function() {
        $(this).closest('.modal-content').find('.modal-body form').submit();
    });
});

We need to add a CSS class submit-modal-form-button.

Or without it:

$('.modal-footer button:last-child').click(function() {
    $(this).closest('.modal-content').find('.modal-body form').submit();
});
code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward