开发者

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>".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜