nested jquery tabs

In this example below you will see how to do a nested jquery tabs with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 1bladesforhire, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 1bladesforhire ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>nested jquery tabs</title>
  
  
  <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div id="tabs">
    <ul>
        <li><a href="#tabs-1">First tab</a></li>
        <li><a href="#tabs-2">Second tab</a></li>
    </ul>
    <div id="tabs-1">
        <p>
            <div id="tabs1">
                <ul>
                    <li><a href="#tabs-11">First nested 1</a></li>
                    <li><a href="#tabs-12">Second nested 1</a></li>
                </ul>
                <div id="tabs-11">
                    <p>Content for first nested tab 1-1</p>
                </div>
                <div id="tabs-12">
                    <p>Content for second nested tab 1-2</p>
                </div>
            </div>            
        </p>
    </div>
    <div id="tabs-2">
        <p>
            <div id="tabs2">
                <ul>
                    <li><a href="#tabs-21">First nested tab 2</a></li>
                    <li><a href="#tabs-22">Second nested tab 2</a></li>
                </ul>
                <div id="tabs-21">
                    <p>Content of first nested tab 2-1</p>
                </div>   
                <div id="tabs-22">
                    <p>Content of second nested tab 2-2</p>
                </div>
            </div>        
        </p>
    </div>
</div>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/1bladesforhire/nested-jquery-tabs-XbpmMZ */
.ui-state-active {
  background: red;
}

/*Downloaded from https://www.codeseek.co/1bladesforhire/nested-jquery-tabs-XbpmMZ */
$('#tabs').tabs();
$('#tabs1').tabs();
$('#tabs2').tabs();

Comments