Jquery 移除 select option

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lm9521/article/details/88062545
<select id = "type" name="type">
    <option value=""></option>
</select>

1.  移除 select  下的 option

以 id

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

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

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

以name

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

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

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

2. 移除 select 下 除了第一个之外的所有 option

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

猜你喜欢

转载自blog.csdn.net/lm9521/article/details/88062545