简体   繁体   English

在jQuery中使用标签页-清除标签页内容

[英]using tabs with jQuery - Clear tab content

I'm using jquery tabs in my web application. 我在Web应用程序中使用jquery标签。 The tabs are created dynamically depending on the user query result. 根据用户查询结果动态创建选项卡。 I have a couple issues: 我有几个问题:

  1. My tab is pointing to <div> content with the corresponding id. 我的标签指向具有相应ID的<div>内容。 When the user clicks the tab, the content is filled with a result of a webservice request (not relevant to the issue). 当用户单击选项卡时,将用Web服务请求的结果填充内容(与问题无关)。 My first problem is that when I add the items inside the tab ( <div> tags), I see that it's not being placed inside the panel of the tab. 我的第一个问题是,当我在选项卡( <div>标签)中添加项目时,我发现它没有被放置选项卡的面板内。 I'm using selectedTab.append("<div class=itemSummary>" + getItemDetails(element) + "</div>") to add a new <div> section to the tab. 我正在使用selectedTab.append("<div class=itemSummary>" + getItemDetails(element) + "</div>")将新的<div>部分添加到选项卡。 However, I do see new items being added outside the border of the tab panel. 但是,我确实看到选项卡面板边框之外添加了新项目。 Am I doing something wrong here? 我在这里做错什么了吗?

  2. Simple question: how can I programmatically clear the tab content? 一个简单的问题:如何以编程方式清除选项卡内容? I need the tab content to be cleared before I add new items to it. 在向其中添加新项目之前,我需要清除该标签内容。

Thanks! 谢谢!

simple, use the $.empty(); 简单,使用$ .empty(); function on the container that own the content . 对拥有内容的容器起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM