V
V
Vadim Yagofarov2018-07-29 17:11:59
MODX
Vadim Yagofarov, 2018-07-29 17:11:59

How can I make the form close after submitting?

Site on modx and made on bootstrap 4. Modal window from bootstrap. Website http://artplastorerenburg.rf/. the form is sent, the alert is shown, but then there is a dark background around the edges of which you press and it disappears. This is the background of the modal window. How to make everything close after an alert? Here is the js responsible for closing and alert

const modal = document.getElementById('exampleModal')
    const closeBtn = document.getElementsByClassName('btn__order')[0]
  closeBtn.addEventListener('click', function() {
        modal.classList.remove('show')
        alert("Спасибо за заявку! Скоро мы с вами свяжемся.");
        return;
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Reutov, 2018-07-29
@Black_Tafita

the div is responsible for the gray background You need to hide it too<div class="modal-backdrop fade show"></div>

document.getElementsByClassName("modal-backdrop")[0].classList.remove("show")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question