Please tell me why the on click event is repeated. Ie, when the modal window opens and we get to the event:
$(document).on("click", ".confirm-success", function(event)
It is called several times. And if you open and close the window and click on the button, the event will be triggered every time one more time.
$("body").on("click", ".ConfirmPostRequestToServer", function() { // данные самого окна var box_modal_id = getNewId(); var c = $('<div class="box-modal" />'); c.prepend('<div class="box-modal_close arcticmodal-close">X</div>'); c.attr('id', box_modal_id); // MODAL-CONFIRM var button = ''; button += '<div class="box-modal-confirm-button">'; button += '<button class="large green awesome confirm-success">Подтвердить</button>'; button += ' <button class="large awesome arcticmodal-close">Отмена</button>'; button += '</div><div class="modal-loader"></div>'; c.html('Предупреждение'+button); var arcticmodalData = {content: c}; $.arcticmodal(arcticmodalData); $(document).on("click", ".confirm-success", function(event){ event.preventDefault(); console.log(1); return false; }); return false; });