Reputation: 509
I am trying to get a very basic example of select2 working but I am running into issues. There are no errors in my console saying that select2 is encountering errors, but the test select box is only displaying the default.
<head>
<link rel="stylesheet" href="~/Content/css/select2.css" />
<script src="~/Scripts/jquery-2.2.1.js"></script>
<script src="~/Scripts/select2.js"></script>
<script type="text/javascript">
$("#sel").select2();
</script>
<head>
<body>
<select id="sel">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
<body>
Is there something that I am just not seeing?
Upvotes: 0
Views: 1310
Reputation: 304
Try do this.
<head>
<link rel="stylesheet" href="~/Content/css/select2.css" />
<script src="~/Scripts/jquery-2.2.1.js"></script>
<script src="~/Scripts/select2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#sel").select2();
});
</script>
<head>
<body>
<select id="sel">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
<body>
Upvotes: 5