首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >jquery删除父cur.element的父

jquery删除父cur.element的父
EN

Stack Overflow用户
提问于 2018-09-05 19:58:33
回答 2查看 50关注 0票数 0

您好,我没有删除parnet。

我的代码:

代码语言:javascript
运行
复制
  <div class="prdctfltr_add_scroll">
   <div class="prdctfltr_checkboxes">
      <label class="prdctfltr_ft_">
        <input type="checkbox" value="">
         <span>
            <img src="" onerror="delNoneOptionFilters(this)" class="product_filter_none_option">
            <script>function delNoneOptionFilters( x ){ $(x).closest('label').remove; }</script>
         </span>
      </label>
      <label class="prdctfltr_ft_popularity">
        <input type="checkbox" value="popularity">
        <span>Popularity</span>
      </label>
      <label class="prdctfltr_ft_rating">
        <input type="checkbox" value="rating">
        <span>Average rating</span>
      </label>
      <label class="prdctfltr_ft_date">
        <input type="checkbox" value="date">
        <span>Newness</span>
      </label>
        <label class="prdctfltr_ft_price">
        <input type="checkbox" value="price">
        <span>Price: low to high</span>
      </label>
      <label class="prdctfltr_ft_price-desc">
        <input type="checkbox" value="price-desc">
        <span>Price: high to low</span>
      </label>
   </div>
</div>

我想删除标签class="prdctfltr_ft_“

EN

Stack Overflow用户

发布于 2018-09-05 20:03:47

remove不是一个属性,它是一个你必须像这个$(x).closest('label').remove()一样使用的function

代码语言:javascript
运行
复制
function delNoneOptionFilters( x ){
$(x).closest('label').remove();
}
代码语言:javascript
运行
复制
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="prdctfltr_add_scroll">
   <div class="prdctfltr_checkboxes">
      <label class="prdctfltr_ft_">
        <input type="checkbox" value="">
         <span>
           <button onclick="delNoneOptionFilters(this)">delete</button>
           
         </span>
      </label>
      <label class="prdctfltr_ft_popularity"><input type="checkbox" value="popularity"><span>Popularity</span></label><label class="prdctfltr_ft_rating"><input type="checkbox" value="rating"><span>Average rating</span></label><label class="prdctfltr_ft_date"><input type="checkbox" value="date"><span>Newness</span></label><label class="prdctfltr_ft_price"><input type="checkbox" value="price"><span>Price: low to high</span></label><label class="prdctfltr_ft_price-desc"><input type="checkbox" value="price-desc"><span>Price: high to low</span></label>                       
   </div>
</div>

票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52184591

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档