select2 - hiding the search box

前端 未结 18 1713
太阳男子
太阳男子 2021-01-29 19:04

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

18条回答
  •  -上瘾入骨i
    2021-01-29 19:43

    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
    });
    

提交回复
热议问题