Clever "add tag" javascript help needed
- by Camran
I have this function for adding options to a Select list:
function addOption(selectbox, value, text, cl )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
if (cl==1){ optn.className = "nav_option_main"; }
selectbox.options.add(optn);
}
I have just discovered the "optgroup" tag, but I don't know how to implement it to the drop list.
The function above is called on another selectboxes "OnChange" event, to fill sub-select-box with the desired options.
I don't think it should be too difficult to add the "optgroup" tag into this, or is it?
Thanks and if you need more input let me know...