Resetting Select2 value in dropdown with reset button

前端 未结 16 1075
别跟我提以往
别跟我提以往 2020-12-23 13:00

What would be the best way to reset the selected item to default? I\'m using Select2 library and when using a normal button type=\"reset\", the value i

16条回答
  •  温柔的废话
    2020-12-23 13:40

    According to the latest version (select2 3.4.5) documented here, it would be as simple as:

     $("#my_select").select2("val", "");
    

提交回复
热议问题