Topic: Missing data-mdb-placeholder css class
vgoenka free asked 2 years ago
Expected behavior https://mdbootstrap.com/docs/standard/forms/select/#section-select-with-placeholder
Expected to find data-mdb-placeholder class as per the URL above.
Looked at both 3.1.0 and 3.2.0 but don't see this class.
Resources (screenshots, code snippets etc.)
The documentation on the web should clearly annotate which version these things are introduced in - or perhaps there should be version specific documentation. This is quite frustrating.
Grzegorz Bujański staff answered 2 years ago
When creating the select component, we made sure that it works in the same way as the native select. Therefore, in this case, you cannot set up a placeholder this way.
This will only work for Multiselect. You can add an option with an empty value and
selected attribute. I also suggest adding a
hidden attribute so that it doesn't show up in the options list. This will make select appear as if it had a placeholder. Here's an example: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/2862444
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: 3.2.0
- Device: Macbook
- Browser: Chrome
- OS: MacOS
- Provided sample code: No
- Provided link: Yes
Grzegorz Bujański staff commented 2 years ago
What do you mean you don't see this class? Does the attribute:
data-mdb-placeholderwork for you? This attribute has not been added in the meantime. It has been available since version
1.0.0-alpha2in which we added the select component.
vgoenka free commented 2 years ago
The attribute didn't work when I tried. (my bad about calling it 'class' in my comment above).
I'm only including mdb.min.css and mdb.min.js. Do I need to include any other file?