Bootstrap disable tabs

Bootstrap disable tabs We can make tabs disabled using jQuery. Here in this article we are going to explain how you can use jQuery to disable tabs.

Bootstrap disable tabs Example

You can add disabled class and the below jQuery to check the disabled class and return false-

Bootstrap disable tabs Example:

<title>Bootstrap Grid</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="">
<script src=""></script>
<!-- Latest compiled and minified JavaScript -->
<script src=""></script>
<script type="text/javascript">
    $(".mytabs a").click(function(e){
     if ($(this).hasClass("disabled")) {
      alert("This tab is disabled");
       return false;
<div class="container">
  <ul class="nav nav-tabs mytabs">
    <li class="active"><a href="#tab1"">Home</a></li>
    <li><a href="#tab2">Menu 1</a></li>
    <li><a href="#tab3">Menu 2</a></li>
    <li><a href="#tab4" class="disabled">Menu 3</a></li>   
 <div id="tab1"  class="tab-pane fade in active" >Tab 1</div>
<div id="tab2"  class="tab-pane fade">Tab 2</div>
<div id="tab3"  class="tab-pane fade">Tab 3</div>
<div id="tab4"  class="tab-pane fade ">Tab 4</div>


Try it »

If you click on the disabled menu it will display the alert message – “This tab is disabled.”

Bootstrap disable tabs


Add Comment

📖 Read More