Set the Tab Created as Active Tab

Set the Tab Created as Active Tab

Hi, 

New to jquery UI...was working with jquery UI - Tab Control 

After the tab is created, i want to have it selected. This code is based of the sample in the link above

 function addTab(controld) {
        var tabTitle = controld;
        var tabContent = "tab Content ";
        var tabTemplate = "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close' role='presentation'>Remove Tab</span></li>";
        var label = tabTitle,
        id = "tabs" + tabCounter,
        li = $(tabTemplate.replace(/#\{href\}/g, "#" + id).replace(/#\{label\}/g, label)),
        tabContentHtml = tabTitle + ' ' + tabContent;

        tabs.find(".ui-tabs-nav").append(li);
        tabs.append("<div id='" + id + "'><p>" + tabContentHtml + "</p></div>");
        tabs.tabs("refresh");


        tabCounter++;
    }

I tried doing this right before and after          tabs.tabs("refresh"); but it dont work
        $("#tabs").tabs( //To select a particular Tab 
            { active: 1 }
        );