开发者

Closing jQuery Ui Tabs

开发者 https://www.devze.com 2023-02-22 01:52 出处:网络
I have followed the instructions on the jQuery site to close jQuery tabs but its not working. below is my code snippet.

I have followed the instructions on the jQuery site to close jQuery tabs but its not working. below is my code snippet.

<script type="text/javascript" src="js/ui.tabs.closable.min.js"></script>

var mainTab = $("#contentTab").tabs({closable: true});
$("#checkup").cl开发者_StackOverflowick(function(){

mainTab.tabs('add','checkup.php','CheckUp');
var newIndex = mainTab.tabs("length") - 1;
mainTab.tabs("select", newIndex);
});

$("#registration").click(function(){

mainTab.tabs('add','reception.php','Registration');
var newIndex = mainTab.tabs("length") - 1;
mainTab.tabs("select", newIndex);


Check out A Close Button for jQuery UI Tabs and working demo.


My Solution:

function closeTab(tabTitle) {
 $('ul li[role=tab] a').each(function() {
  var parent = $(this).parent();
  if ($('a',parent).text() == tabTitle) {
   $('span',parent).click();
  }
 });
}
0

精彩评论

暂无评论...
验证码 换一张
取 消