can we add new <optgroup> dynamically to dynamically generated <select> box?
How we can set new <optgroup>,its label and <options> under that group to the selection using javascript? I am generating dynamic selection box. I have to add optgroup dynamically to that selection box whenever the user press the button. (add selection). How can i do this? guide me.
Are you having specific problems with <optgroup> or do you need to know how to create any new html tag?
The html is rendered on your page already. So, in order to display different html like <optgroup> and <options> you have to insert those tags into the existing hmtl or replace some of the existing html, and that requires that you learn about the wonderful world of the DOM.
I wants to add new <select> tag and <optgroup> and <options> under this optgroup optgroup under select. how can i create new optgroup and add it to newly createed select.
i know how to add options using .options object of select element reference. i don't know how to create new optgroup and how to add it to select.?
Bookmarks