Reputation: 1047
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").click(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);
Upvotes: 2
Views: 6054
Reputation: 1
My Solution:
function closeTab(tabTitle) {
$('ul li[role=tab] a').each(function() {
var parent = $(this).parent();
if ($('a',parent).text() == tabTitle) {
$('span',parent).click();
}
});
}
Upvotes: 0
Reputation: 29547
Check out A Close Button for jQuery UI Tabs and working demo.
Upvotes: 2