Advertisement
metalx1000

HTML Tabs and Sections jQuery JavaScript

Feb 2nd, 2020
754
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <title>My Page</title>
  5.     <meta charset="utf-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1">
  7.     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" crossorigin="anonymous">
  8.     <script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
  9.     <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" crossorigin="anonymous"></script>
  10.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" crossorigin="anonymous"></script>
  11.     <script>
  12.       $(document).ready(function(){
  13.         $(".section").hide();
  14.         $("#sec3").show();
  15.  
  16.         $(".secbtn").click(function(){
  17.           $(".section").hide();
  18.           var sec = $(this).attr("sec");
  19.           $("#"+sec).show();
  20.         });
  21.       });
  22.     </script>
  23.   </head>
  24.   <body>
  25.     <br>
  26.     <div class="btn-group btn-group-justified">
  27.       <a sec="sec1" href="#" class="secbtn btn btn-primary">Section #1</a>
  28.       <a sec="sec2" href="#" class="secbtn btn btn-primary">Section #2</a>
  29.       <a sec="sec3" href="#" class="secbtn btn btn-primary">Section #3</a>
  30.     </div>
  31.  
  32.     <hr>
  33.     <br><br><br>
  34.     <div id="sec1" class="container section">
  35.       <div class="row">
  36.         <div class="alert alert-danger">
  37.           <h1>HELP this is a section</h2>
  38.           <pre>
  39.             This is the help section.
  40.             I should be helpful
  41.             I hope it is
  42.           </pre>
  43.  
  44.           </div>
  45.       </div>
  46.       <div class="row">
  47.         <div class="alert alert-danger">
  48.           <h1>HELP this is a section</h2>
  49.           <pre>
  50.             This is the help section.
  51.             I should be helpful
  52.             I hope it is
  53.           </pre>
  54.  
  55.           </div>
  56.       </div>
  57.       <div class="row">
  58.         <div class="alert alert-danger">
  59.           <h1>HELP this is a section</h2>
  60.           <pre>
  61.             This is the help section.
  62.             I should be helpful
  63.             I hope it is
  64.           </pre>
  65.  
  66.           </div>
  67.       </div>
  68.     </div>
  69.  
  70.     <div id="sec2" class="container section">
  71.       <div class="row">
  72.         <div class="alert alert-info">
  73.           <h1>Hey this is another section</h1>
  74.           <pre>
  75.               This is some information
  76.               I hope it is helpful
  77.           </pre>
  78.           </div>
  79.  
  80.  
  81.       </div>
  82.     </div>
  83.     <div id="sec3" class="container section">
  84.       <div class="row">
  85.         <div class="alert alert-success">
  86.           <h1>Section #3</h1>
  87.           YES it is one more section</div>
  88.       </div>
  89.     </div>
  90.   </body>
  91. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement