MDB5 initialize a dinamically created select item


Topic: MDB5 initialize a dinamically created select item

soiware pro premium priority asked 2 years ago

I create dynamically a select item. But it is not rendered in MDB5 style. Same behavior if I load the html source embedding select items dinamically into the main page. I know I have to execute this code in order to initialize input text in similar situation:

// Input init, due to late loading of the html
document.querySelectorAll('.form-outline').forEach((formOutline) => {
    new mdb.Input(formOutline).init();
});

Is there a similar init procedure for select?


mlazaru staff answered 2 years ago

Hi,

Im not 100% sure if I understood the case. You simply want to initialize select using JS code instead of adding select class?

Let me know if the code helps you or not: https://mdbootstrap.com/snippets/standard/mlazaru/4315978#js-tab-view


soiware pro premium priority commented 2 years ago

Thank you mlazaru your code is fine! This is what I was looking for.


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
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: Any
  • Browser: Any
  • OS: Any
  • Provided sample code: No
  • Provided link: No
Tags