Bootstrap adds a custom click event to the Tab tab

If you use the tab switching function of Bootstrap's tab page, but you need to add your own processing operation to each click event of the title, at this time we can modify it like this, the click event of the tab:

            $('#myTab a').click(function (e) {
			  e.preventDefault();
			  $(this).tab('show');
			  //其他操作
			  showNews();
			});
            <ul id="myTab" class="nav nav-tabs">
			   <li class="active"><a href="#tab1" data-toggle="tab">标题1</a></li>
			   <li><a href="#tab2" data-toggle="tab">标题2</a></li>
			</ul>
			<div id="myTabContent" class="tab-content">
			   <div class="tab-pane fade in active" id="tab1">内容1</div>
               <div class="tab-pane fade in active" id="tab2">内容2</div>
            </div>

Guess you like

Origin blog.csdn.net/Doulvme/article/details/126546384
Tab
Tab
Tab
Tab