add option to select combobox
To add option to select you can use :
If you need to append multi value you can user:
If you need to add option to first "top" of list use
- <code>
- $('#selectname').append($("<option></option>").attr("value", value).text(text));
- </code>
- <code>
- $.each(data, function(i, option) {
- $('#selectname').append($('<option>').attr("value", option.id).text(option.name));
- });
- </option></code>
- <code>
- $('#sel_bat1').children(":first").before($("<option selected="selected"></option>").attr("value", value).text(text));
- </code>