There is a button to submit the form button. By clicking on it, a modal window should appear at the end. Instead, a window appears, immediately the page reloads and the window disappears. I understand that this is precisely because it is a button. What is the way out?
The problem is exactly when the button is in the form tag. And it does not matter where our modal window is, in the form or not. Anyway, the window opens and closes immediately.
$("#sub_toggle").click(function() { $('#sub_modal').show(); }); <div id="sub_modal"></div> <button id="sub_toggle"></button>