var tabs = $ ("#tabs"). tabs (); varTabcount=0; functionJqui_addtab (tabid,url,caption) {if($ ("#tabs-" +tabid). length==0) {Tabcount++; varPanelid = Tabs.find (". Ui-tabs-active"). attr ("Aria-controls") ); Tabs.find ('. Ui-tabs-active '). Removeclass ("Ui-tabs-active"); $("#tabs-" +panelid). CSS (' Display ', ' none ')); varLi = ' <li tabindex= ' ' +tabcount+ ' "><a href=" #tabs-' +tabid+ ' "> ' +caption+ ' </a> <span class=" Ui-icon ui-icon-close ui-tabs-active "role=" presentation "onclick="Jqui_closetab (This)"> Close </span></li>"; Tabs.find (". Ui-tabs-nav"). Append (LI); Tabs.append ("<div id= ' tabs-" + tabid + "' ><iframe class= ' tabsframe ' frameborder= ' no ' border= ' 0 ' src= '" +url+ "' width= ' 100% ' H Eight= ' "+frameheight+" px ' ></iframe></div> " ); Tabs.tabs (' Refresh '); $(' #tabs '). Tabs (' option ', ' active ', Tabcount);//Display the TAB} you just addedfunctionJqui_closetab (obj) {//Close tabvarCtlid = $ (obj). Parent (). attr (' Aria-controls '); $("#"+ctlid). Remove (); $ (obj). Parent (). remove (); Tabcount--; Tabs.tabs (' Refresh '); }
jquery-ui-1.11.4 tabs dynamic Add and close