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

  • SEARCH
  • Home
  • 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 7533843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:50:39+00:00 2026-05-30T05:50:39+00:00

This is jQuery tabs script: http://jqueryui.com/demos/tabs/#manipulation var $tabs = $( #tabs).tabs({ tabTemplate: <li><a href=’#{href}’>#{label}</a>

  • 0

This is jQuery tabs script: http://jqueryui.com/demos/tabs/#manipulation

        var $tabs = $( "#tabs").tabs({
            tabTemplate: "<li><a href='#{href}'>#{label}</a> <span class='ui-icon ui-icon-close'>Remove Tab</span></li>",
            add: function( event, ui ) {
                var tab_content = $tab_content_input.val() || "Tab " + tab_counter + " content.";
                $( ui.panel ).append( "<p>" + tab_content + "</p>" );
            }
        });

// rest of script

So, what’s I need? I need to script will be setting (with other content) on line var tab_content = . Normally (in script with static tabs) my own script is loading on the bottom of page (i was create a few instance of the same script like (founction(script1), founciton(script2) and 2 divs with id script1 and script2), after all HTML code, but in this case I don’t know how to do this. I need to script be unique for each tabs.

  • 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-05-30T05:50:41+00:00Added an answer on May 30, 2026 at 5:50 am

    Assume that the underlying HTML looks like this:

    <div id="tabs">
      <ul>
        <li><a name="my_id" href="/watman">Hey</a></li>
        <li><a name="test_it" href="/brown-chicken-brown-cow">Hey2</a></li>
      </ul>
    </div>
    

    Here’s what I used in such situation. In global script I define variables

    var _SCRIPT = {};
    var _CURRENT_TAB = '#ui-tabs-1';
    var _CURRENT_TAB_NAME = 'my_id';
    

    Now for each tab I load a script in the head of the main view (after the global script). The scripts I’m loading look like this:

    _SCRIPT['my_id'] = {
      tab: null,
      init: function() {
        this.tab = _CURRENT_TAB;
        // initialize script
      },
      // some other fields
    }
    

    where my_id is the name that is going to be associated with the tab I’m going to load. Next I generate tabs with my main JavaScript like this:

    $('#tabs').tabs({
      // some other options
      ajaxOptions: {
        cache: false,
        complete: function() {
          _SCRIPT[_CURRENT_TAB_NAME].init();
        },
      },
      select: function(event, ui) {
        _CURRENT_TAB = $(ui.tab).attr('href');
        _CURRENT_TAB_NAME = $(ui.tab).attr('name');
      },
      cache: true,
    });
    

    Now every html that goes inside a tab, say my_id can be accessed via jQuery like this (code from function _SCRIPT['my_id'].init or any other function inside _SCRIPT['my_id']):

    console.log( $('a', this.tab) );
    

    Note that this will return elements only inside my_id tab.

    Side note 1: I do not recommend inserting script tags via ajax. Hard to debug and you can easily loose control over ”namespaces”. Also you will have problems whenever you reload the tab.

    Side note 2: be careful about defining id attribute on elements in tabs. Keep in mind that they need to be unique across the HTML document.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://jqueryfordesigners.com/jquery-tabs/ for a project, the tabbing code looks like this:- <script type=text/javascript
I'm using http://jqueryfordesigners.com/jquery-tabs/ for a project, the tabbing javascript code looks like this: <script
According to this page: http://jqueryui.com/demos/tabs/#ajax I can have the content of tabs in separate
I have a page with tabs on it that you this jQuery script http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/
JQuery UI let us have tabs loaded dynamically: http://jqueryui.com/demos/tabs/#ajax My question is: if the
I am working from this example: http://jqueryui.com/demos/tabs/ and trying to get the tabs to
I have a question about ultra simple jquery tabs. I use this script: http://jsfiddle.net/HX5KZ/2/
Am using jquery and tabs based on http://www.sohtanaka.com/web-design/simple-tabs-w-css-jquery/ <script type=text/javascript> $(function() { $(.tab_content).hide(); //Hide
Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
I have different php output in jQuery-based tabs. This output is formed from database

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.