Topic: Select component duplicates when users press back button in browser

Edu Lima free asked 2 years ago


When a user returns to the previous page, the select component is duplicated.

I have tried to reset it but I am unable to get this to work. Here's what I tried:

const select = document.querySelector('#select') const instance = mdb.Select.getInstance(select) instance.dispose() new mdb.Select(select)

Expected behaviour

enter image description here

Actual

enter image description here

How can I make sure the select is reseted correctly?

Thanks


Kamila Pieńkowska staff answered 2 years ago


Can you recreate in a snippet how are you initiating select components on your page? Because obviously, it is reinitiating when you revisit the page it sits on. https://mdbootstrap.com/snippets/



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 Standard
  • MDB Version: MDB5 4.4.0
  • Device: n/a
  • Browser: Chrome
  • OS: os
  • Provided sample code: No
  • Provided link: No