optgroup not viewable?
Why is the optgroup here not viewable?
All options are shown, but not the group name
http://jsfiddle.net/UCNJ8/
$('<select></select>').app开发者_高级运维endTo('body').append('<option value="0">test</option>')
.append($('<optgroup>group</optgroup>')
.append('<option value="1">group test</option>'));
The group name is set via the label
attribute (HTML4 specification), not by its content (only option
elements can be children of optgroup
elements).
$('<optgroup />', {label: "group"})
DEMO
精彩评论