Roland Roland - 6 months ago 18
jQuery Question

Appending Item to dropdown list without selecting the item

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

remove selected

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