select2搜索框查询加遍历

摘要:
公司名称--请选择--${item.name}注意:jquery应该在select2˂!
<div class="form-group">
                    <label class="control-label col-sm-1 no-padding-right" for="entId">公司名称</label>
                    <div class="col-sm-10">
                        <div class="clearfix">
                            <select class="js-example-basic-single js-states form-control" name="entId" id="entId" style="100%">
                                <option value="" _level="-1">--请选择--</option>
                                <c:forEach items="${hjPztEntInfoList}" var="item">
                                    <option value="${item.value}">${item.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div> 


注意:jquery要在select2的上面
<!-- JQuery script -->
<!-- 非IE浏览器不会识别IE的条件注释,所以这里判断非IE需要如下写法:参照下面jquery-2.1.4.min.js引入的方式 -->
<!--[if !IE]><!-->
<script type="text/javascript" src="${ctx}/resources/js/plugins/jquery/jquery-2.1.4.min.js"></script>
<!--<![endif]-->
<!--[if IE]>
<script type="text/javascript" src="http://t.zoukankan.com/${ctx}/resources/js/plugins/jquery/jquery-1.11.3.min.js"></script>
<![endif]-->
<script type="text/javascript" src="${ctx}/resources/js/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/plugins/select2/zh-CN.js"></script>
<script src="${ctx}/resources/js/pzt/base/hjPztTalentInfo_Detail.js"></script>
这里只有搜索框

$(function(){ $("#entId").select2({ templateSelection : function(selection) { return $.trim(selection.text); } }); validateTalentInfoForm(); })
这里是有加小图标的

$(function(){ $("#entId").select2({ //templateResult : formatState, templateSelection : function(selection) { return $.trim(selection.text); } }); validateTalentInfoForm(); }) function formatState(state) { var $state = $('<span><i class="fa fa-file-text-o green"></i>&nbsp;&nbsp;' + state.text + '</span>'); return $state; }

 

免责声明:文章转载自《select2搜索框查询加遍历》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Linux 系统编程 学习:3-进程间通信1:Unix IPC(2)信号MySQL/MariaDB数据库的查询缓存优化下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

highcharts(数据可视化框架),ajax传递数据问题

1.引入 Highcharts 注意用什么功能就按照官方引用对应的js <%--highcharts视图js--%> <script src="/js/Highcharts/code/highcharts.js"></script> <script src="/js/Highcharts/code/...

【JavaWeb项目】一个众筹网站的开发(四)后台用户注册功能

重点: 密码加密存储 使用jQuery插件做校验和错误提示等 密码不能明文存储,在数据库中是加密存储的 可逆加密:通过密文使用解密算法得到明文 DES AES 不可逆加密:通过密文,得不到明文 MD5 SHA-1 SHA-2 MD5优点:压缩性,长度固定;容易计算;抗修改性;强抗碰撞;MD5加盐值加密码 一、公司的工具类中加入MD5 proje...

从V8引擎编程理解javascript执行环境

一、V8简介 google code上对它的解释如下: V8 is Google's open source JavaScript engine. V8 is written in C++ and is used in Google Chrome, the open source browser from Google. V8 implements...

AirtestIDE基本功能(一)

上期回顾:AirtestIDE环境安装 上次我们已经介绍了AirtestIDE如何安装,下面我们启动AirtestIDE来看看里面都有哪些功能呢? Airtest辅助窗(左上):这里主要是用来生成airtest框架中的代码的。 Poco辅助窗(左下):这个主要是用来抓取元素信息的,类似于Chrome F12查看Web元素、Appium Inspecto...

常用的js跳转页面方法实现汇总

1.window.location.href方式 <script language="javascript" type="text/javascript"> window.location.href="target.jsp"; </script> 2.window.navigate方式跳转 <scri...

[转]Linux中如何自动启动服务

linux自动启动服务很简单,最简单的是把启动命令放到/etc/rc.d/rc.local文件里。这样就可以每次启动的时候自动启动服务了。例如对于 apache,编译好apache后会在安装目录的bin下生成apachectl文件,这是个启动脚本,我们只需要把这个命令加到rc.local里就可以了:echo /usr/local/apache/bin/ap...