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();
});
Check a checkbox
Use the :checked pseudo-selector:
$('#js-i-agree').on('change', function () {
$(this).is(':checked');
});
Build a query string from an object
const params = {
action: 'one',
name: 'two',
amount: 'three'
};
const uri = $.param(params);
// Result: "action=one&name=two&amount=three"
Libraries
Tooltips: open_in_new darktooltip .
Andrew Dorokhov