How to disable tabs in Bootstrap

Topic: Bootstrap / Less« Prev|Next »

Answer: Remove data-toggle="tab" from Tabs

You can remove the attribute data-toggle="tab" from the tab's <a> element to disable a Bootstrap tab. Further you can add the class .disabled to the parent <li> element to make it look like disabled visually. Here's an example:

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="UTF-8">
  • <title>Disable Clicks on Bootstrap Tabs</title>
  • <link rel="stylesheet" href="css/bootstrap.min.css">
  • <link rel="stylesheet" href="css/bootstrap-theme.min.css">
  • <script src=""></script>
  • <script src="js/bootstrap.min.js"></script>
  • </head>
  • <body>
  •     <ul class="nav nav-tabs">
  •         <li class="active"><a data-toggle="tab" href="#home">Home</a></li>
  •         <li><a data-toggle="tab" href="#profile">Profile</a></li>
  •         <li class="disabled"><a href="#admin">Admin</a></li>
  •     </ul>
  •     <div class="tab-content">
  •         <div id="home" class="tab-pane fade in active">
  •             <p>Aliquip placeat salvia cillum iphone...</p>
  •         </div>
  •         <div id="profile" class="tab-pane fade">
  •             <p>Vestibulum nec erat eu nulla rhoncu non neque...</p>
  •         </div>
  •         <div id="admin" class="tab-pane fade">
  •             <p>Sed consequat ante in rutrum convallis...</p>
  •         </div>
  •     </div>
  • </body>
  • </html>

Related FAQ

Here are some more FAQ related to this topic:


Your Feedback:


We would love to hear from you! Please say something.