Javascript 将字段从数据库显示到select2 multiple
我在数据库中有一个字段,该列稍后将使用PHP显示在jQuerySelect2上,我将询问所有问题,我如何在jQuerySelect2中显示 对不起,我的英语不好Javascript 将字段从数据库显示到select2 multiple,javascript,php,jquery,codeigniter,select2,Javascript,Php,Jquery,Codeigniter,Select2,我在数据库中有一个字段,该列稍后将使用PHP显示在jQuerySelect2上,我将询问所有问题,我如何在jQuerySelect2中显示 对不起,我的英语不好-从数据库中检索选择框信息 - Retrieve select box information from database - add to the option - add select 2 library to your page - give a class to select box so that you can refe
-从数据库中检索选择框信息
- Retrieve select box information from database
- add to the option
- add select 2 library to your page
- give a class to select box so that you can refer in JavaScript
- then add below code
<script type="text/javascript"> $(class name of select box).select2(); </script>
-添加到选项中
-将select 2库添加到您的页面
-给出一个类来选择框,以便可以在JavaScript中引用
-然后添加下面的代码
$(选择框的类名)。select2();
参考:-