simple select2

by RobertSudwarts

HTML

<script src="http://ivaynberg.github.io/select2/select2-master/select2.js"></script>
<link rel="stylesheet" href="http://ivaynberg.github.io/select2/select2-master/select2.css">
<select id="how" name="how">
    <option value="0">Family</option>
    <option value="1">Agent</option>
    <option value="2">internet</option>
    <option value="3">zippos circus</option>
    <option value="4">other</option>
</select>
<div>
    <p id="selected"></p>

JavaScript

$("#how").prop("selectedIndex", -1)
    .select2({
    width: '95%',
    placeholder: "make a choice",
    minimumResultsForSearch: -1,
    allowClear: true,
})
    .on('change', function (e) {
    //var data = $(choice).data('select2-data');
    //console.log('changed', e.val, e.choice);
    var sel = e.val;
    $('#selected').html(sel);
});