解决方法
Eric Saupe知道如何做:
http://ericsaupe.com/tag/bootstrap-3-tabs-example-ajax/
http://ericsaupe.com/tag/bootstrap-3-tabs-example-ajax/
$('a[data-toggle="tab"]').on('shown.bs.tab',function (e) { var target = $(e.target).attr("href") // activated tab alert(target); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <ul id="myTab" class="nav nav-tabs"> <li class="active"><a href="#home" data-toggle="tab">Home</a></li> <li class=""><a href="#profile" data-toggle="tab">Profile</a></li> </ul> <div id="myTabContent" class="tab-content"> <div class="tab-pane fade active in" id="home"> home tab! </div> <div class="tab-pane fade" id="profile"> profile tab! </div> </div>