Resetting Select2 value in dropdown with reset button

前端 未结 16 1072
别跟我提以往
别跟我提以往 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 14:04

    Just to that :)

    $('#form-edit').trigger("reset");
    $('#form-edit').find('select').each(function(){
      $(this).change();
    });
    

提交回复
热议问题