WB
Web Bae•15mo ago
Anish

Select Option Attribute

What's the best way to add attribute to select field options ?
4 Replies
Web Bae
Web Bae•15mo ago
Hey @Anish you can do this with javascript but without an example I don't know what else to advise here.
Anish
AnishOP•15mo ago
Hey @Web Bae So, I have a select field where first option is "How can we help you?" I'm looking for a way to not show it when select field is clicked.
No description
No description
Web Bae
Web Bae•15mo ago
Thanks for the clarification @Anish Since "How can we help you?" is in the options list, it will always show in the open menu. Usually when I see this style of select, people give that first option the selected and the disabled along with the required attributes. This shows it as the main option but doesn't allow the user to submit the form until a different option is chosen. If you really need to remove it from the display list you'd need to code your own select, which is not trivial esp. to include accessibility and everything you get with the default component. Some libraries are available as well as Finsweet Select but I'm not sure is provides an option for the behavior you are looking for.
Anish
AnishOP•15mo ago
Makes Sense @Web Bae ! Thanks 🙌
Want results from more Discord servers?
Add your server