I can never define placeholder text in Select2 JQuery Plugin. I tried the code
$("#first").select2({
placeholder: {id: "", text: "Choose an option…"}
});
but it doesn't work for me. My code is here
And, how to rectangle for search be rounded, what is the version of Select2?
You have to add an empty option to the beginning of your select element:
<select name="first" id="first">
<option></option>
...
</select>
Then simply add a placeholder like this:
$(document).ready(function(){
$("#first").select2({
placeholder: "Your placeholder",
allowClear: false
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With