jQueryの選択オプションを削除します

免責事項:この記事はブロガーオリジナル記事ですが、許可ブロガーなく再生してはなりません。https://blog.csdn.net/lm9521/article/details/88062545
<select id = "type" name="type">
    <option value=""></option>
</select>

1.選択してオプションを削除

以 id

$("#type").html("");

$("#type").find("option").remove();

$("#type").empty();

以name

$("select[name='type']").html("");

$("select[name='type']").remove();

$("select[name='type']").empty();

2.選択の下を除くすべてが、最初のオプションを削除

  $("select[name='type'] option:gt(0)").remove();

 

おすすめ

転載: blog.csdn.net/lm9521/article/details/88062545