1 回答
TA贡献1880条经验 获得超4个赞
只是jquery:
$("a[data-toggle=tab]").each(function(){ ($(this).text() === 'Tab Name') ? $(this).hide() : $(this).show()});
完整的html:
<html>
<head><script src="https://code.jquery.com/jquery-3.5.1.slim.js"></script></head>
<body>
<div class="container">
<div class="row">
<div class="col-3">
<div class="list-group flex-md-column text-center" id="tablist" role="tablist">
<a class="list-group-item list-group-item-action active" data-toggle="tab" role="tab">Tab 1</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 2</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 3</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 4</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 5</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 6</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 7</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 8</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab 9</a>
<a class="list-group-item list-group-item-action" data-toggle="tab" role="tab">Tab Name</a>
</div>
</div>
</div>
</div>
<script>
function hideme() {
$("a[data-toggle=tab]").each(function(){ ($(this).text() === 'Tab Name') ? $(this).hide() : $(this).show()});
};
function showme() {
$("a[data-toggle=tab]").each(function(){ $(this).show() });
};
</script>
<input type=button onclick="hideme()" value="HIDE"/>
<input type=button onclick="showme()" value="SHOW"/>
</body>
</html>
添加回答
举报