Thursday, January 26, 2012

jquery tab - check existing tab by tab lable/title

function checkTabExists(tabname) {
    var tabExists = false;
    $('#tabs ul li a').each(function(i) {
        if (this.text == tabname) {
            tabExists = true;
            $("#tabs").tabs("select", i); // if found, I immediately select to the tab.
        }            
    });  
    return tabExists;
}

No comments: