简体   繁体   中英

Jquery Tabs - reload/refresh content on tab select, how?

I've been researching for several hours now and I can't seem to figure this out. Although I have seen several topics similar to this, I just can't seem to make sense of it — bare in mind I know next to nothing about jquery.

I was able to get running following this tutorial: http://www.jacklmoore.com/notes/jquery-tabs/

It does EXACTLY what I am looking for, BUT I need to be able to reload the tab content or page when I select between the tabs back and forth — of course after the reload I want to still be under the current tab.

Why?

I am using this method as a selector for sorting my comments (newest posted and highest rated). Problem is, the process or functions (comment replies) are loaded on the default tab and when I select to the other tab, any links I click there will only show on the original tab.

What code can I add to reload content so that clicking on tabs reloads the process?

Thanks!

You can use ajax or dynamic content you generated before.

$(".tabs a").on("click", function() {
    var curTabId = $(this).attr("href");
    $(curTabId).load('content.html');
    //or $(curTabId).html(yourGeneratedContent);
});

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