Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

javascript - 在jQuery UI中删除动态创建的选项卡(Removing dynamically created tabs in jQuery UI)

How do I remove tabs that were created dynamically using the jQuery UI library?(如何删除使用jQuery UI库动态创建的选项卡?)

It doesn't seem to mention anything about deleting tabs in the documentation for the library.(似乎没有提及有关删除库文档中的选项卡的任何内容。) I need to be able to delete the currently active tab, and to delete all tabs.(我需要能够删除当前活动的选项卡,并删除所有选项卡。)   ask by Howard Zimmerman translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You must now remove the HTML that renders the tab and panel itself and refresh the tabs:(现在,您必须删除呈现选项卡和面板本身的HTML,并刷新选项卡:)

function removeTab(tabId) { var tabIdStr = "#tabs-" + tabId // Remove the panel $( tabIdStr ).remove(); // Refresh the tabs widget tabs.tabs( "refresh" ); // Remove the tab var hrefStr = "a[href='" + tabIdStr + "']" $( hrefStr ).closest("li").remove() } https://forum.jquery.com/topic/dynamically-remove-tab(https://forum.jquery.com/topic/dynamically-remove-tab)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...