怎样用js创建optgroup对象?请给出具体代码。

如题所述

optgroup 标签 -- 代表分组选择项的类别名(此类别名不能选择)

var sel = document.getElementsByTagName("select")[0];
var optgroup = document.createElement("optgroup");
sel.appendChild(optgroup);

追问

如何用new Optgroup()呢?

追答

Option才有,这个没

温馨提示:答案为网友推荐,仅供参考