我正在尝试使用select2
插件,但没有任何效果。我的示例代码是:
<html>
<head>
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.1/css/select2.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0-rc.1/js/select2.min.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
$("#states").select2({
placeholder: "Select a State",
allowClear: true
});
});
</script>
<select id="states">
<option value="AK">Alaska</option>
<option value="HI">Hawaii</option>
...
<option value="VA">Virginia</option>
<option value="WV">West Virginia</option>
</select>
</body>
</html>
我想要一个搜索字段,以便从复选框中搜索值。但是这样只显示了复选框。请帮助!