开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜