select2 drop-down box Reviews

download link:

https://github.com/select2/select2

First import:

<link href="select2.css" rel="stylesheet" type="text/css" />
	<script src="select2.min.js" type="text/javascript"></script>

And, most importantly jq package

<script src="jquery.min.js"></script>

Finally, at the bottom of the bottom of the page, or inside the body

<script type="text/javascript">
	
	//Select2
	jQuery(".select2").select2({
		width : '100%'	//这里的width是当前select显示的宽度,可以随便设置,但是不能等于0
	});
	</script>
remember:

If it does, then check the above js wrote place, <head> which does not work, then you put the following pages! ! !

Code:

<select class="select2" id="test" name="test" style="width: 450px; margin-top: 12px;"
				onchange="selectColumnSecond(this.value);">
			<option value="">---请选择---</option>
		<c:forEach items="${list}" var="bc">
			 <option value="${bc.id}">${bc.colname}</option>
		</c:forEach>
</select>
Use the preceding frame errors do not hurry, there is definitely a problem details! !

Guess you like

Origin blog.csdn.net/qq_41340666/article/details/80983520