jQuery remove options from select

后端 未结 8 917
一生所求
一生所求 2020-11-28 02:58

I have a page with 5 selects that all have a class name \'ct\'. I need to remove the option with a value of \'X\' from each select while running an onclick event. My code is

8条回答
  •  醉梦人生
    2020-11-28 03:41

    For jquery < 1.8 you can use :

    $('#selectedId option').slice(index1,index2).remove()
    

    to remove a especific range of the select options.

提交回复
热议问题