javascript - select2 - json data not showing -



javascript - select2 - json data not showing -

html:

<div> <input type="hidden" style="width:300px" id="search"/> </div>

javascript:

<script> $(document).ready(function(){ $('#search').select2({ data:[{id:1,text:'hello'},{id:2,text:'select2'}] }); }); </script>

result:

select2 version: 3.5.1

your object malformed -

{ data:[{id=1,text='hello'},{id=2,text='select2'}] }

should be

{ data:[{id:1,text:'hello'},{id:2,text:'select2'}] }

javascript html jquery-select2

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -