Add classes to the select options using Phoenix.HTML.Form.select

I’m trying to filter my select options using a second drop down. I found this approach on Stack Overflow http://stackoverflow.com/questions/20477406/filter-category-select-drop-down-based-on-another-drop-down-option, where you use the class of the options to remove the ones that don’t match the value from the drop down used to filter.

Is it possible to add classes to the options when using the select function in HTML.Form? Or is there another way for me to filter the select options?

Thanks!
Axel

1 Like

In case anyone else is trying to do this. I ended up using jQuery to add the class to each option.

1 Like

You can also not use the select_tag thing and roll your own. The implementation should be relatively straight-forward. :slight_smile:

2 Likes