Query:adding empty list item
I'm updating a select box from it's document's child (thickbox)
var opt = "<option value='8'>TEST<option>";
parent.jQuery("#my_teams_list").prepend(opt开发者_JS百科);
Here "my_teams_list" is the id of the parent document's select box.
While doing this an empty list item is added inside of the select box.
I don't know why. Please clear me. thanks in advance.
try: EDIT
parent.jQuery("#my_teams_list").prepend($("<option></option>").text("test").val("test"));
Depending on what your list is (assume <select>) you want to prepend child element not just text so instead of prepending "TEST" prepend "<option>TEST</option>".
精彩评论