Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/418.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将字段从数据库显示到select2 multiple_Javascript_Php_Jquery_Codeigniter_Select2 - Fatal编程技术网

Javascript 将字段从数据库显示到select2 multiple

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

我在数据库中有一个字段,该列稍后将使用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 refer in JavaScript

- then add below code
<script type="text/javascript"> $(class name of select box).select2(); </script>
-添加到选项中 -将select 2库添加到您的页面 -给出一个类来选择框,以便可以在JavaScript中引用 -然后添加下面的代码 $(选择框的类名)。select2();
参考:-