Answer the question
In order to leave comments, you need to log in
How can I make the modal window close only when clicking on "close"?
Hey!
Question. When the button is clicked, the form is loaded from the server and loaded into the modal window. The bottom line is that if you filled in some fields, and accidentally clicked outside the modal window, the window will close, and everything written will be lost. So, is there any standard way (add some class) to close the modal window only when you click on the button intended for this?
Answer the question
In order to leave comments, you need to log in
You can catch any other events (click past the form, press the Esc key, etc.) and ignore the action.
It is also possible to issue a confirmation notification when the form is closed, but this will not be pleasant for the user.
You can set a condition that if not all fields are filled out, do not close the form, or again display a notification confirming the action.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question