Topic: Programatically show modal form
djmarkm free asked 4 years ago
Hi I've used one of the simple modal form examples to add a modal login form to my site. The login data is posted to a separate php file which processes the login and return to the referral page if unsuccessful with vars holding the errors. Obviously when the referral page reloads the modal form is once again hidden until the Login (show modal) button is pressed. However, I need to programmatically force show the model form on page load in this case. I've tried calling the .click event of the show modal button on page load but this doesn't seem to work. Does anyone have any ideas? Is there a class I can set to force the modal to be visible?
Mateusz Łubianka staff answered 4 years ago
Hi @djmarkm,
Try to use this function:
$(function() {
$('#basicExampleModal').modal('show');
});
Best,
djmarkm free commented 4 years ago
Hi
That's perfect
Thanks! :)
Mateusz Łubianka staff commented 4 years ago
I'm glad I could help :)
Best,
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.12.0
- Device: PC
- Browser: Chrome / Edge Chromium / Firefox
- OS: Windows 10
- Provided sample code: No
- Provided link: No