Secondary initialize "mdb-select" is possible

MDB SupportCategory: MDB jQuerySecondary initialize "mdb-select" is possible
Boris Akimenko Pro User asked 3 months ago in MDB pro, version:4.5.3

Hi guys!
Secondary initialized  $(‘.mdb-select’).material_select(); gives multiple material view on already initialized selects.

So if I dynamically add some <select> element, then I have to get this element and initialize it instead just run $(‘.mdb-select’).material_select().

2 Answers
Mikołaj Smoleński answered 3 months ago

Hi Boris,

Can You try to give select a new class each time You add the next select? Then You can initialize only this select without changing the others.


Alex Gotardi Pro User answered 2 months ago



or destroy and create mdb-select, but’s more expensive to browser cpu-usage


// Material Select Destroy
Mikołaj Smoleński replied 2 months ago

Boris, is Alex solution working in Your project?

Boris Akimenko Pro User replied 2 months ago

Thank you Alex!
But destroy is not good way as you say 🙂
Init function must check selects by class which added when it initialized

Mikołaj Smoleński replied 2 months ago

Thanks for sharing Your solution!