How To Display A Bootstrap Modal On Submitting A Form?
I am making a form. So in that i have set javascript validation for all the fields. I want the modal to pop-up only if the form is valid when the user clicks the submit button Pls
Solution 1:
You can use on submit function:
$('form').on('submit', function (e) {
e.preventDefault();
$('#myModal').modal('show');
})
Solution 2:
JS
function myfn() {
$('#myModal').modal('show');
}
HTML
<form onsubmit="event.preventDefault(); myfn()">
//all inputs and other info
</form>
Post a Comment for "How To Display A Bootstrap Modal On Submitting A Form?"