mozilla
Your Search Results

    appendItem

    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.

    Example

    <script language="javascript">
    function addItemsToList(){
    	var list = document.getElementById('myMenuList');
    
    	// add item with just the label
    	list.appendItem('One');
    
    	// add item with label and value
    	list.appendItem('Two', 999);
    
    	// Select the first item
    	list.selectedIndex = 0;
    }
    </script>
    
    <button label="Add items" oncommand="addItemsToList()"/>
    <menulist id="myMenuList">
      <menupopup/>
    </menulist>
    

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, Enn, MarkFinkle, ethertank, Marsf, trevorh, Ptak82, Mgjbot, Pmash, Dria
    Last updated by: Sheppy,