mdbootstrap / TW-Elements

𝙃𝙪𝙜𝙚 collection of Tailwind MIT licensed (free) components, sections and templates 😎
https://tw-elements.com
MIT License
12.77k stars 1.62k forks source link

[Select] Can't attach events to select's options when there are more than 2 selects #2333

Open jpelay opened 3 months ago

jpelay commented 3 months ago

I have two selects in one page and I want to attach an event handler to do something when they are selected, but there's no way to target each one of these divs, because as far as I can see there's no id or name I can know in advance.

iprzybysz commented 3 months ago

Hi @jpelay, check out our Select API documentation and Events section. There are available events in the Select component. If you want to do something when the option is selected, just get a select element by id and add an event listener on it - if there is no id, just add it to the select tag.