moses toh
moses toh

Reputation: 13192

Why select2 not working?

I take the example from here.

I try in my localhost like this :

<select id="e1" style="width:300px">
    <option value="AL">Alabama</option>
    <option value="Am">Amalapuram</option>
    <option value="An">Anakapalli</option>
    <option value="Ak">Akkayapalem</option>
    <option value="WY">Wyoming</option>
</select>


<script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.9.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/select2/3.2/select2.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/select2/3.2/select2.css"></script>

<script type="text/javascript">
    $('#e1').select2({

    });
</script>

But it's not working

The result is like this :

enter image description here

Any solution to solve my problem?

Thank you

Upvotes: 0

Views: 3103

Answers (1)

Guruprasad J Rao
Guruprasad J Rao

Reputation: 29693

Include css with link not with script as below:

<link href="http://cdnjs.cloudflare.com/ajax/libs/select2/3.2/select2.css" rel="stylesheet"/>

Also check for the dependency of select2 versions with jquery versions..

Upvotes: 6

Related Questions