removing all options of select box except 1st option

前端 未结 8 2134
情书的邮戳
情书的邮戳 2020-12-29 01:20

I\'m trying to empty select options when:

id \"mClick\" is selected, id\'s \"sClick\", \"cClick\" and \"srClick\" will be emptied.

id \"sClick\" is selected,

8条回答
  •  离开以前
    2020-12-29 01:59

    you can use the greater than :gt() selector of jQuery for this

    $('#lForm select[id!="makeClick"] select[id!="stateClick"] select[id!="cityClick"] option:gt(0)').remove().end();
    

    This will remove all options that are greater than 0

提交回复
热议问题