Why is the optgroup here not viewable?
All options are shown, but not the group name
$('<select></select>').appendTo('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"})