Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


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,



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • 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