この JavaScript を作成して、ページ上のすべてのリンクを取得し、リンクの長さ == 0 の場合はスパン タグを非表示にします。私の問題は、linktext を含むすべてのスパン要素を非表示にすることで、0 の更新よりも多くなります。HTML マークアップを含めますが、いくつかのビューがあります。 1 ページのタイル 8 のタグ ID は lnkBtnTags で、スパン タグをラップします。
<div class="resource" style="position: absolute; left: 240px; top: 0px;">
<div class="resource-head clearfix">
<img class="pull-left" src="/ideapark/DesktopModules/ResourcesFilter/img/3.png" alt="icon type" width="36" height="36">
<p class="resource-title pull-left">
Learning Strategies
</p>
<div class="favorite-resource favorited pull-right">
<input type="image" name="dnn$ctr687$View$rp_resList$ctl01$imgBtn_bookmark" id="dnn_ctr687_View_rp_resList_imgBtn_bookmark_1" src="/ideaPark/DesktopModules/ResourcesFilter/img/favorite-star-yellow.png">
</div>
</div>
<div class="resource-body">
<input type="hidden" name="dnn$ctr687$View$rp_resList$ctl01$hf_resID" id="dnn_ctr687_View_rp_resList_hf_resID_1" value="92">
<p class="resource-subtitle"><a href="http://localhost/ideapark/WebsofWonder/SortingMats.aspx">Sorting Mats</a></p>
<p>
Sorting Mats are used to assist students in organizing and classifying data and objects.
</p>
<div class="resource-links">
<p><a id="dnn_ctr687_View_rp_resList_lb_like_1" class="resource-like" href="javascript:__doPostBack('dnn$ctr687$View$rp_resList$ctl01$lb_like','')">Liked</a> <strong>·</strong> <a id="hl_download" class="resource-download hideLinke" href="/ideaPark/DesktopModules/ResourceModule/pdf_resources/">Download</a> </p>
</div>
<div class="resource-tags clearfix">
<span class="resource-tag pull-left">
<a id="lnkBtnTags" class="tagsLinks" href="javascript:__doPostBack('dnn$ctr687$View$rp_resList$ctl01$rp_tagsTopics$ctl00$lnkBtnTags','')"></a>
</span>
</div>
</div>
</div>
Script
$(".tagsLinks").each(function () {
var linkTxt = $(this).text();
console.log(linkTxt.length);
if (linkTxt.length == 0)
{
$(".resource-tag").addClass("hideLinke");
}
});