Bootstrap disable tabs
home
Run
screen_rotation
fullscreen
cloud_download
<html> <head> <title>Bootstrap Grid</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".mytabs a").click(function(e){ if ($(this).hasClass("disabled")) { e.preventDefault(); alert("This tab is disabled"); return false; }else{ e.preventDefault(); $(this).tab('show'); } }); }); </script> </head> <body> <div class="container"> <h3>Tabs</h3> <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> </ul> <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> </div> </body> </html>
<html> <head> <title>Bootstrap Grid</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".mytabs a").click(function(e){ if ($(this).hasClass("disabled")) { e.preventDefault(); alert("This tab is disabled"); return false; }else{ e.preventDefault(); $(this).tab('show'); } }); }); </script> </head> <body> <div class="container"> <h3>Tabs</h3> <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> </ul> <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> </div> </body> </html>
Copyrights@tutorialsplane.com