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

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

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


="filter-p-tag-c9a54479-0d2d-4e3c-867a-672d88a4e65c" class="collection__filter-collapsible" aria-hidden="false" style="height: auto; overflow: visible;">
    ="collection__filter-checkbox-list" role="list">
  • ="collection__filter-checkbox">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-64mm" name="filter.p.tag" value="64mm" onclick="tagopen()"> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-70mm" name="filter.p.tag" value="70mm"> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-80mm" name="filter.p.tag" value="80mm"> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-90mm" name="filter.p.tag" value="90mm"> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
  • ="collection__filter-checkbox" style="display:none;">
    ="checkbox-wrapper"> ="checkbox" class="checkbox" id="filter.p.tag-" name="filter.p.tag" value=""> ="false" class="icon icon--check " viewBox="0 0 24 24" role="presentation"> ="currentColor" d="M9 20l-7-7 3-3 4 4L19 4l3 3z">
if($('#span-64mm').length)
$('#filter.p.tag-64mm').prop('checked',true)

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632