For my more significant selects, the search box in Select2 is wonderful. However, in one instance, I have a simple selection of 4 hard-coded choices. In this case, the search bo
If the select is show results one have to use this:
$('#yourSelect2ControlId').select2("close").parent().hide();
it closes the search results box and then set control unvisible
If you want to hide search for a specific drop down use the id attribute for that.
$('#select_id').select2({ minimumResultsForSearch: -1 });
@Misha Kobrin's answer work well for me So I have decided to explain it more
You want to hide the search box you can do it by jQuery.
for example you have initialized select2 plugin on a drop down having id audience
element_select = '#audience';// id or class
$(element_select).select2("close").parent().hide();
The example works on all devices on which select2 works.
See this thread https://github.com/ivaynberg/select2/issues/489, you can hide the search box by setting minimumResultsForSearch to a negative value.
$('select').select2({
minimumResultsForSearch: -1
});
.no-search .select2-search { display:none } $("#test").select2({ dropdownCssClass : 'no-search' });
try this CSS
input[aria-controls=select2-product-type-results]{
display: none;
}
this input is search field