简体   繁体   中英

using tabs with jQuery - Clear tab content

I'm using jquery tabs in my web application. 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. When the user clicks the tab, the content is filled with a result of a webservice request (not relevant to the issue). 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. I'm using selectedTab.append("<div class=itemSummary>" + getItemDetails(element) + "</div>") to add a new <div> section to the tab. 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(); function on the container that own the content .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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