我正在创建一个模板,供同事使用手风琴在所见即所得编辑器(我是一名老师)中使用,这样他们就可以轻松地向每个模板添加内容。它将有多余的标题/内容供同事使用,但不会显示任何具有“title_name”之类的内容作为标题文本。HTML 是:
<div class="accordion">
<div class="card">
<div class="card-header" data-toggle="collapse">
<h2 class="card-title">
Accordion 1
</h2>
</div>
<div class="collapse">
<div class="card-body">
<p>Insert Accordion 1 of 4 content here.</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2 class="card-title">
Accordion 2
</h2>
</div>
<div class="collapse">
<div class="card-body">
<p>Insert Accordion 2 of 4 content here.</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2 class="card-title">
Accordion 3
</h2>
</div>
<div class="collapse">
<div class="card-body">
<p>Insert Accordion 3 of 4 content here.</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h2 class="card-title">
title_name
</h2>
</div>
<div class="collapse">
<div class="card-body">
<p>Insert Accordion 4 of 4 content here.</p>
</div>
</div>
</div>
</div>
我的jquery是
$(".card-header").each(function(){ ($(this).text() === "title_name") ? $(this).hide() : $(this).show()});
非常感谢您的帮助:)
UYOU
相关分类