How to clear all selected items in a SELECT input using jQuery?

前端 未结 10 1856
北海茫月
北海茫月 2020-12-28 13:55

I am think this should be fairly easy, but struggling a bit ... I have a SELECT input element that allows the user to select multiple items. I would like to pro

10条回答
  •  时光取名叫无心
    2020-12-28 14:23

    This worked to clear all selected options for me..

    $("#selectListName").prop('selectedIndex', -1)
    

    The select list looked like

    
    

提交回复
热议问题