Topic: Inherit native <select> and <options> id's or classes to mdbselect generated element
Hi i was trying to find a way to move all the id's or classes that i give to a select element and his options to the new generated with the mdb-select class.
For example this:
<select id="selectID" class="mdb-select">
<option value="" disabled selected>Basic select</option>
<option id="optionID1" class="clase1" value="1">Option 1</option>
<option id="optionID2" class="clase2" value="2">Option 2</option>
</select>
Become this:
<div class="select-wrapper mdb-select">
<span class="caret"><i class="material-icons">arrow_drop_down</i></span>
<input type="text" class="select-dropdown" readonly="true" data-activates="select-options-df449b7f-99b7-456f-9a9c-385c4b97b6a4" value="">
<ul id="select-options-df449b7f-99b7-456f-9a9c-385c4b97b6a4" class="dropdown-content select-dropdown w-100 ">
<li class="disabled active"><span class="filtrable">Basic select</span></li>
<li class=" "><span class="filtrable">Option 1</span></li>
<li class=" "><span class="filtrable">Option 2</span></li>
</ul>
<select id="selectID" class="mdb-select initialized">
<option value="" disabled="" selected="">Basic select</option>
<option id="optionID1" class="clase1" value="1">Option 1</option>
<option id="optionID2" class="clase2" value="2">Option 2</option>
</select>
</div>
I was looking the documentation but the options or attributes are not working :(
Does anyone have an example of how to use it properly?https://mdbootstrap.com/docs/jquery/forms/select/#select-options-and-attributes
Thanks!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Open
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.5.9
- Device: All
- Browser: All
- OS: All
- Provided sample code: No
- Provided link: Yes
Grzegorz Bujański staff commented 5 years ago
Hi. Hi. I don't understand what exactly you want to do? Material select is not working in your project?