请问一个问题,jquery如何只使用一条语句,不循环,一次添加多个option(下拉框)?
1个回答
展开全部
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#demoselect").append("<option>1</option><option>2</option>"); //将下拉内容拼接好就能加进去.
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<select id="demoselect">
</select>
</div>
</form>
</body>
</html>
<script type="text/javascript">
$(function () {
$("#demoselect").append("<option>1</option><option>2</option>"); //将下拉内容拼接好就能加进去.
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<select id="demoselect">
</select>
</div>
</form>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询