html select search code example
Example 1: searchable dropdown bootstrap
Example 2: search in dropdown
function formatState (state) {
if (!state.id) {
return state.text;
}
var baseUrl = "/user/pages/images/flags";
var $state = $(
' ' + state.text + ''
);
return $state;
};
$(".js-example-templating").select2({
templateResult: formatState
});