Home >Web Front-end >HTML Tutorial >怎么给控件select动态添加option选项_html/css_WEB-ITnose

怎么给控件select动态添加option选项_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-21 09:27:071614browse

<select id="myselect">	<option value="1">aaa</option>	<option value="2">bbb</option>	<option value="3">ccc</option>	<option value="4">ddd</option>	<option value="5">eee</option>	<option value="6">fff</option></select>


上面这张select控件么,如果里面的option选项我需要在通过ajax获取到数据后再添加,该怎么实现啊?

var Child = $("#myselect").children().last();
Child.append("");
这样子添加不对呀。
求高手指教。


回复讨论(解决方案)

$("#myselect").append("");

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn