How to disable tabs in Bootstrap?

How to disable tabs in Bootstrap?

Asked on November 1, 2018 in Bootstrap.
Add Comment


  • 1 Answer(s)

        Tabs in bootstrap can be disabled by removing attribute data-toggle=”tab” from Tabs.

        And then we can add the class .disabled to the parent <li> element to make it look like disabled visually.
    For 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="https://code.jquery.com/jquery-1.11.2.min.js"></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>
    
    Answered on November 1, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.