Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:06:48+00:00 2026-06-15T22:06:48+00:00

So, I’m trying to come up with a way to dynamically load content into

  • 0

So,

I’m trying to come up with a way to dynamically load content into multiple tabs, where each tab can contain anywhere from one to several elements (reports).

Currently, the reports are loaded on page load with jQuery $.load. I’m using Bootstrap and bootstrap tabs. I found a site that teaches how to load multiple tabs, but not specifically what I need to do. That site is here: http://www.mightywebdeveloper.com/coding/bootstrap-2-tabs-jquery-load-content/

In contrast, each tab is set up more like this:

<div id="tab1">
<div id="report1"></div>
<div id="report2"></div>
</div>

I cannot use the top-level div to load the content, because it will potentially have multiple children. I need to loop through the div’s, use regex to parse the ID, and load each report when the tabs are changed.

I haven’t yet figured out the regex expression, but it should be fairly simple – the element id will be something like this : “#be78f5aa3-25”. This is an alphanumeric 9-character dbid, followed by a hypen, followed by a 1-3 digit integer (not starting in 0). Then I need to split those two strings into separate variables and inject them into an API call.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:06:49+00:00Added an answer on June 15, 2026 at 10:06 pm

    Anyone looking to load multiple pages into bootstrap tabs may find this of use. I was able to get it working using some regex (specific to my application), placing div’s within the tab-pane container’s that had an Element Id which could be used to create the report I wanted to load into the container using $.load. I also added a few things for persistent tabs when the user went to another page and then used the back button, and another condition to load the content in the first tab if there was no hash in the URL.

    I’m sure it could be cleaned up, but you get the gist..

    $(function() {
        "use strict";
        var baseURL, $navbox;
        baseURL = window.location.protocol + "//" + window.location.hostname + "/db/";
        $navbox = $("#myTabs");
        $navbox.bind("show", function(e) {
            var contentID, pattern, selectDiv;
            pattern = /#(\Btab|tab\B)?(\Bdropdown|dropdown\B)?([1-9]{1}[0-9]*)/i;
            contentID = e.target.toString().match(pattern)[0];
            selectDiv = contentID + " > div";
            return $(selectDiv).each(function() {
                var parts = this.id.match(/(##enter regex here)/);
                if (parts) {
                    $(this).load(baseURL + parts[0]);
                    return;
                }
                return $("#myTabs").tab();
            });
        });
        if (window.location.hash) {
            $('#myTabs').find('a[href="'+window.location.hash+'"]').tab('show');
        }
        else { 
            var elemID = "#"+$('[class^="tab-pane active"]').attr('id') + " > div";
            $(elemID).each(function() {
                var parts = this.id.match(/(##enter regex here)/);
                $(this).load(baseURL + parts[0]);
                return $("#myTabs").tab();
            });
        }
    });
    
    $('#myTabs a').click(function (e) {
        e.preventDefault();
        var bob = jQuery(this).attr("href");
        bob = jQuery.trim(bob);
        if(bob == "" || bob == "javascript:void(0)") {
            return;
        }
        else {
            window.location.hash = $(this).attr('href');
            $(this).tab('show');
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.