Topic: Clear Modal Form On Close

Alindsay81 priority asked 4 years ago

Hello, I have a modal form based on the examples, when a user partially completes the form but presses cancel to close the modal the modal is not cleared, the next time the modal is opened the old content remains - i have tried various methods to clear the modal etc but i cant get any to work - i wonder if someone could suggest a method perhaps using js

Mateusz Łubianka staff answered 4 years ago


Try to use function. This event is fired immediately when the hide instance method has been called. More info about it:

$('#myModal').on('', function (e) {

    $('#yourForm').find("input[type=text], textarea").val("");


Alindsay81 priority commented 4 years ago

Great, Thank you so much

Mateusz Łubianka staff commented 4 years ago

I'm glad everything works


Please insert min. 20 characters.


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



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.13.0
  • Device: Windows 10
  • Browser: All
  • OS: WIndows 10
  • Provided sample code: No
  • Provided link: No