开发者

optgroup not viewable?

开发者 https://www.devze.com 2023-03-29 20:44 出处:网络
Why is the optgroup here not viewable? All options are shown, but not the group name http://jsfiddle.net/UCNJ8/

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

精彩评论

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

关注公众号