« XUL Reference home
appendItem( label, value )
Return type: element
Creates a new item and adds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element.


<script language="javascript">
function addItemsToList(){
	var list = document.getElementById('myMenuList');

	// add item with just the label

	// add item with label and value
	list.appendItem('Two', 999);

	// Select the first item
	list.selectedIndex = 0;

<button label="Add items" oncommand="addItemsToList()"/>
<menulist id="myMenuList">

See also