admin管理员组文章数量:1415139
I am using Twitter Bootstrap, and had successfully implemented the tabs. I have a button that should display on all the tabs except for one, any idea how should I do that?
<div class="span6 offset1">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#general" data-toggle="tab">General</a></li>
<li><a href="#example2" data-toggle="tab">Example2</a></li>
<li><a href="#example3" data-toggle="tab">Example3</a></li>
</ul>
<div class="tab-content">
<div id="general" class="tab-pane fade in active" >
//content
</div>
<div id="example2" class="tab-pane fade" >
//content
</div>
<div id="example3" class="tab-pane fade" >
//content
</div>
</div>
</div>
<input type="submit" style="width:120px" class='btn btn-primary' id="update" value="Update"/>
</div>
How do I program it such that when tab example3 is shown, the update button will be hidden, but still remains on page when tab general and example2 is shown.
Thanks!
I am using Twitter Bootstrap, and had successfully implemented the tabs. I have a button that should display on all the tabs except for one, any idea how should I do that?
<div class="span6 offset1">
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#general" data-toggle="tab">General</a></li>
<li><a href="#example2" data-toggle="tab">Example2</a></li>
<li><a href="#example3" data-toggle="tab">Example3</a></li>
</ul>
<div class="tab-content">
<div id="general" class="tab-pane fade in active" >
//content
</div>
<div id="example2" class="tab-pane fade" >
//content
</div>
<div id="example3" class="tab-pane fade" >
//content
</div>
</div>
</div>
<input type="submit" style="width:120px" class='btn btn-primary' id="update" value="Update"/>
</div>
How do I program it such that when tab example3 is shown, the update button will be hidden, but still remains on page when tab general and example2 is shown.
Thanks!
Share Improve this question edited Feb 27, 2020 at 17:39 isherwood 61.2k16 gold badges122 silver badges170 bronze badges asked Apr 19, 2012 at 9:39 revolverrevolver 2,4055 gold badges25 silver badges40 bronze badges2 Answers
Reset to default 3I am not sure that is there any event being fired in bootstrap tabs. But the simplest way can be to use mouseclick event on example3 link or even you can try to trigger custom event.
$('a[href="#example3"]').on('click',function(){
$("#update").hide();
});
use .style.display = 'none'
e.g.
document.getElementById(id).style.display = 'none';
本文标签: javascriptHow to hide an element when certain tabs is shownStack Overflow
版权声明:本文标题:javascript - How to hide an element when certain tabs is shown - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745229770a2648770.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论