Appending Item to dropdown list without selecting the item

Elitmiar picture Elitmiar · Feb 4, 2011 · Viewed 14.1k times · Source

I have a form wherr I fill in an item name and immediately after I hit submit the item adds to the select dropdownlist and is automatically selected. Is there a way not to have this newly added item selected?

My code that adds the item looks like this

$("#userGroup_groups").append("<option value="41" selected="selected">item</option>");

Answer

Vivek picture Vivek · Feb 4, 2011

remove selected

$("#userGroup_groups").append("<option value=\"41\" >item</option>");