Questions tagged «jquery-select2-4»

12
使用Ajax选择2 4.0.0初始值
我有一个从Ajax数组填充的select2 v4.0.0。如果我设置了select2的值,则可以通过JavaScript调试看到它选择了正确的项(在我的情况下为#3),但是在选择框中未显示该值,它仍显示占位符。 而我应该看到这样的事情: 在我的表单字段中: <input name="creditor_id" type="hidden" value="3"> <div class="form-group minimal form-gap-after"> <span class="col-xs-3 control-label minimal"> <label for="Creditor:">Creditor:</label> </span> <div class="col-xs-9"> <div class="input-group col-xs-8 pull-left select2-bootstrap-prepend"> <select class="creditor_select2 input-xlarge form-control minimal select2 col-xs-8"> <option></option> </select> </div> </div> </div> 我的JavaScript: var initial_creditor_id = "3"; $(".creditor_select2").select2({ ajax: { url: "/admin/api/transactions/creditorlist", dataType: 'json', …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.