Hi @abiodunajai ,
How do I trigger a POPUP with onClick Sumbit button
There are two methods to show the popup before submitting the form:
One is to change the submit
type button to a button
type button.
Another one is to use the event.preventDefault()
method to prevent the default submit button submit behavior. code like this:
I have amended the script as directed by changing the type=''submit' to type='button' with the new Javascript but it is still not firing the Popup.
It will be greatly appreciated if a Fiddle is attached for a practical demonstration, please.
Agree with Bruce, perhaps the submit and redirect action is too fast. You can try to remove the $("form").submit();
from the JS function, in this scenario, the form is not submitted and the popup will continue displaying.
Or, you can use the setTimeout method to wait 2 seconds, after the timeout it will submit the form. code like this:
// Wrap in setTimeout so the UI can update the spinners
$(".submit-progress").removeClass("hidden");
//submit the form.
setTimeout(function () {
$("form").submit();
}, 2000);
The output as below: you can view the source code from here: 204021-pagecode.txt
If using the above methods the popup still not showing, try to use F12 developer tools to check if there any error.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion