Reputation: 1692
I am using the ajax feature of the Select2 control to load the options asynchronously. However, I would like to change the default template of the search box to have a placeholder and an icon on the right.
Is there a proper way to do that?
Upvotes: 0
Views: 460
Reputation: 430
Placeholder: From the example:
$(".js-example-placeholder-single").select2({
placeholder: "Select a state",
allowClear: true
});
Custom Icon:
You can append it using JS. Simply create a DOM element, append it where you want and style it with CSS. Of course you can also add its additional functionality if needed.
http://www.w3schools.com/jsref/met_node_appendchild.asp
Upvotes: 1