西西木科技丨Shopify开发机构 2022-11-29 20:15 采纳率: 96.4%
浏览 39
已结题

根据span id显示改变input checked状态

根据span id是否显示改变input checked状态

#span-64mm 存在时,下面的#filter.p.tag-64mm状态是checked或者背景颜色修改一下


<div id="filter-p-tag-c9a54479-0d2d-4e3c-867a-672d88a4e65c" class="collection__filter-collapsible" aria-hidden="false" style="height: auto; overflow: visible;">
                             <ul class="collection__filter-checkbox-list" role="list">
                                  <li class="collection__filter-checkbox">
                                    <div class="checkbox-wrapper">
                                       <input type="checkbox" class="checkbox" id="filter.p.tag-64mm" name="filter.p.tag" value="64mm" onclick="tagopen()">
                                       <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation">
      <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path>
    </svg>
                                    
<label for="filter.p.tag-64mm">64mm</label> <li class="collection__filter-checkbox" style=""> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-70mm" name="filter.p.tag" value="70mm"> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-70mm">70mm</label> <li class="collection__filter-checkbox" style=""> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-80mm" name="filter.p.tag" value="80mm"> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-80mm">80mm</label> <li class="collection__filter-checkbox" style=""> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-90mm" name="filter.p.tag" value="90mm"> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-90mm">90mm</label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label> <li class="collection__filter-checkbox" style="display:none;"> <div class="checkbox-wrapper"> <input type="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> <svg focusable="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> <path fill="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z"></path> </svg>
<label for="filter.p.tag-"></label>

2条回答 默认 最新

  • CSDN专家-showbo 2022-11-29 20:39
    关注
    if($('#span-64mm').length)
    $('#filter.p.tag-64mm').prop('checked',true)
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

悬赏问题