Metro-UI-CSS
Metro-UI-CSS copied to clipboard
Dynamically adding optgroups and options from multiple arrays or nested objects from javascript/jquery
Hello I will like to bring your attention to this topic.
Code is here: https://jsfiddle.net/kaqgw6uv/
I am looking to do a dropdown to have options from 2 different categories: dogs and cats so that a user is able to select pets from either one. I want to create this dynamically using javascript as eventually the data will be from a spreadsheet or json.
Currently, the code can only show either dogs or cats, while I have separate arrays representing dogs and cats.
How to solve?
Basically, I don't think you can currently edit selects in JS and use optgroup...