Ask questions and get good answers on mb.jQuery.components

I can dynamically add tabs. But how to remove them?

asked Aug 11 '11 at 02:23

Ameet's gravatar image

Ameet
111


Here are two functions to remove tabs:

$.fn.removeTab=function(tabID){
    var tab= $("#"+tabID, $(this));
    var tabContent= $(tab.attr("content"));
    tab.remove();
    tabContent.remove();
};

$.fn.removeActualTab=function(){
    var tab= $(".tab.sel", $(this));
    var tabContent= $(tab.attr("content"));
    tab.remove();
    tabContent.remove();
};

And the corresponding examples:

<button style="background:white;cursor:pointer" onclick="$('#tabset1').removeTab('a')">remove tab1</button>
<button style="background:white;cursor:pointer" onclick="$('#tabset1').removeActualTab('tabset1')">remove actual tab</button>

Bye, M.

answered Aug 16 '11 at 17:54

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

×6
×5

Asked: Aug 11 '11 at 02:23

Seen: 199 times

Last updated: Aug 16 '11 at 17:54

jQuery main site - Matteo Bicocchi