XUL: create menu items dynamically and set "selected" attr
- by Michael
I have a firefox extension Options pref panel, where I should dynamically create menu items and select particular item to be current.
here is the XUL file part
<menulist id="rss_service_combo">
<menupopup id="rss_service_menu"/>
</menulist>
Then in load event of the pref panel, using js I append menuitem elements into menupop. This is working fine. The only problem is that even if I set the selected element the item is not selected and combo box is initially empty.
The only way is working at the moment is if I manually add those menuitems into XUL file and set selected attribute, but I need to do it dynamically.