我在jQuery中动态地创建了一个下拉框,方法是添加如下html:
.append("<br><SELECT NAME='Month_list' class='month_selection'</SELECT>");它可以很好地创建,但我尝试使用以下代码动态地向它添加选项:
$('.month_selection:last').options.add(new Option(month_array[index]));但是我在Firebug中得到了以下错误:
$(".month_selection:last").options is undefined选择器工作得很好,因为我可以运行$(".month_selection:last").remove()代码行,下拉框被移除,从各种tutes中我可以看出.options是如何访问选项的,那么我做错了什么?感谢您的阅读。
https://stackoverflow.com/questions/3809113
复制相似问题