select2 - hiding the search box

前端 未结 18 1924
太阳男子
太阳男子 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条回答
  •  既然无缘
    2021-01-29 19:42

    @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.

提交回复
热议问题