【发布时间】:2014-07-25 11:30:18
【问题描述】:
我正在尝试将选项标签附加/附加到表单中附加的选择输入中。 只是我的表单像这样附加到正文中:
c.append( $('<form>').attr({
'method': 'POST',
'action': ''
}).append( $('<select />').attr({
'name': 'retour'
}) ));
现在我想在此表单中附加选项标签,而不必像 5 次那样创建 .append( $('<option>').attr() ) 等。
我发现了以下问题:
- jQuery append inside appended element
- What is the best way to add options to a select from an array with jQuery?
- Programmatically create select list
但它们都不适用于我的情况。 希望有人知道答案,谢谢。
【问题讨论】:
标签: jquery select append option appendto