似乎无法将 Select2 设为 运行
Can't seem to get Select2 to run
我正在尝试按照他们在其网站上提供的指南 (https://select2.github.io/) 来测试 Select2。我基本上想到的是在 html 文件中包含 URI 以及一个允许用户 select 两种状态的简单下拉菜单。但是,当尝试 运行 时,Select2 似乎根本没有实现。想知道我是否遗漏了什么?
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
</script>
<select class="js-example-basic-single">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
也许是个愚蠢的错误...您还记得包括 jQuery 吗?
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
<select class="js-example-basic-single">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
我正在尝试按照他们在其网站上提供的指南 (https://select2.github.io/) 来测试 Select2。我基本上想到的是在 html 文件中包含 URI 以及一个允许用户 select 两种状态的简单下拉菜单。但是,当尝试 运行 时,Select2 似乎根本没有实现。想知道我是否遗漏了什么?
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
</script>
<select class="js-example-basic-single">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
也许是个愚蠢的错误...您还记得包括 jQuery 吗?
$(document).ready(function() {
$(".js-example-basic-single").select2();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/js/select2.min.js"></script>
<select class="js-example-basic-single">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>