我做了一个组合框。
我从数据库中获取数据并将名字的值设置为选择的组合框,但它不起作用。这是我的代码:
$('#invoices_invoicesbundle_invoicestype_firstname').val('{{firstname}}');
这是我的选择框 html:
<select id="invoices_invoicesbundle_invoicestype_firstname" required="required" name="invoices_invoicesbundle_invoicestype[firstname]">
<option selected="selected" disabled="disabled">Please Choose</option>
<option value="2">Ilyas</option>
<option value="3">Arif</option>
<option value="4">Ali</option>
<option value="5">Arslan</option>
</select>
{{firstname}}
值为阿里,如何设置阿里为选中?