removing all options of select box except 1st option

前端 未结 8 2143
情书的邮戳
情书的邮戳 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 02:09

    I was looking for one line code, what I found after lots of research is the Simplest and Best one line code to remove everything except first.

    JQuery,

    $('#ddlId option:not(:first)').remove();
    

提交回复
热议问题