这是我的代码,但我无法获得所需的select2 支持通过搜索框进行快速选项过滤。
<link href="jsps/css/select2.css" rel="stylesheet" type="text/css"/>
<link href="jsps/css/select2-bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="jsps/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<script src="jsps/js/select2.js" type="text/javascript"></script>
<script src="jsps/js/select2.min.js" type="text/javascript"></script>
<script src="jsps/js/bootstrap.js" type="text/javascript"></script>
$(document).ready(function(){
alert( 'You are running jQuery version: ' + $.fn.jquery );
alert("ready");
$("#e1").select2();
});
<select id="e1" >
<option value="0">select</option>
<option value="AL">Alabama</option>
<option value="GL">Germany</option>
<option value="PL">Poland</option>
<option value="WY">Wyoming</option>
</select>
请帮助我,让我知道我在做错误的地方
答案 0 :(得分:0)
将jQuery代码放在<scirpt>
标记
<link href="jsps/css/select2.css" rel="stylesheet" type="text/css"/>
<link href="jsps/css/select2-bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="jsps/css/bootstrap.css" rel="stylesheet" type="text/css"/>
<script src="jsps/js/select2.js" type="text/javascript"></script>
<script src="jsps/js/select2.min.js" type="text/javascript"></script>
<script src="jsps/js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
alert( 'You are running jQuery version: ' + $.fn.jquery );
alert("ready");
$("#e1").select2();
});
</script>
<select id="e1" >
<option value="0">select</option>
<option value="AL">Alabama</option>
<option value="GL">Germany</option>
<option value="PL">Poland</option>
<option value="WY">Wyoming</option>
</select>