MarcRohrer free asked 2 years ago

what is the correct way to reset a whole form to its defaults?

robbyirish free commented 2 years ago

with jQuery I use $('#formID').trigger("reset");

MarcRohrer free answered 2 years ago


Works, thank you!


MarcRohrer free answered 2 years ago


I have a working version, thank you. Now I am working on loading data into the form, got from server via fetch. Works fine, but in the end the labels stay inside the edit elements. What function do I use to update that?



Dawid Wajszczuk staff commented 2 years ago

Hi. Try this code and let me know if this works.

document.querySelectorAll('.form-outline').forEach((formOutline) => {
      new mdb.Input(formOutline).update();

Dawid Wajszczuk staff answered 2 years ago


The best way would be to write the whole logic for this in JS. Second option, dispose all pieces of this form and reinitialize them. And the last solution that comes to my mind (and the simplest) would be to try using this (I'm not fully aware how well it works with our kit but you can give it a try).

Keep coding,

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: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.9.0
  • Device: PC
  • Browser: Browser
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No