Select2 Placeholder - 3.4.2

by grahampcharles

HTML

<link rel="stylesheet" href="http://ecos.fws.gov/js/bootstrap-2.0.3/css/bootstrap.css">
<link rel="stylesheet" href="http://ivaynberg.github.com/select2/select2-master/select2.css">
<script src="http://ivaynberg.github.io/select2/select2-3.4.2/select2.js"></script>
<div id="test">

JavaScript

$(document).ready(function() {
    var ret = $("<input>", { "type": "hidden", "placeholder": "Search"  });
    $("#test").empty().append(ret);    

    $(ret).select2({
        allowClear:true,
        data: [ { id: "Test", text: "Text" }, 
              { id: "Test 2", text: "Text 2" }, 
               { id: "Test 3", text: "Text 3" }
              ]
    });

});