0
我想在該羣組中添加羣組標籤,我如何實現這一目標?淘汰賽js dropdownlist羣組圖片
例如該圖像
在這裏,我想在歐洲,NorthAmercia,南美洲組
代碼是在這裏設置的圖像,
<select data-bind="foreach: groups, value: selectedOption">
<optgroup data-bind="attr: {label: label}, foreach: children">
<option data-bind="text: label, option: $data"></option>
</optgroup>
</select>
<hr />
更多的代碼是在這裏:http://jsfiddle.net/rniemeyer/aCS7D/
但我需要圖像在groupnames,我無法找到那裏的例子,我真的不喜歡使用插件:),我們不能把圖像和標籤放在optgroup? – patel
不,您不能將圖像放置在optgroup或選項元素 –
這裏是一個格式化optgroup的快速示例:http://jsfiddle.net/rniemeyer/ws4Mq/ –