jquery.selectBoxIt.js
jquery.selectBoxIt.js copied to clipboard
dynamically add optgroup support?
I've seen how to add options dynamically but how can i add optgroups dynamically? is there a way? even if not a convenient way maybe a more 'hacky' one?
I think only like a string .add("html")
it ignores it :(
try to do .refresh() after add
maybe im doing something wrong?: (ignore the ! mark its just that github wont render it without it) selectbox.data("selectBox-selectBoxIt").add('<!optgroup label="Swedish Cars">'); selectbox.data("selectBox-selectBoxIt").add({ value: index, text: form.title }); selectbox.data("selectBox-selectBoxIt").add('<!/optgroup>'); selectbox.data("selectBox-selectBoxIt").refresh();
var select = $("select").data("selectBox-selectBoxIt"); select.add("optgroup option text option optgroup") select.refresh();
thanks it works, only drawback is that i have to parse by myself all my options and write them as html which is a bit of a pain. P.S the refresh is not needed
@kfir124 @i-have-no-name
Hello,
I am also having the same issue. May i know how to add the optgroup label? Is it using HTML strings? Can you provide an example for this? Thank you so much.