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 7167621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:36:48+00:00 2026-05-28T14:36:48+00:00

I have a lot of code and would like to avoid posting it all

  • 0

I have a lot of code and would like to avoid posting it all here, but if I need to I will or I’ll mock something similar up.

My problem is, I have a hidden div that I am loading a page into (with load()) and then un-hiding (with fadeIn()). When it comes time to put this div away, I load an empty page into the div and then fade it out. I’ve tested the empty page by putting a javascript alert into it and it is indeed loading, but the Javascript that I loaded into the div in the first page is still running. Does this Javascript now belong to the parent page? Is there a way to UNload it so that it is no longer running or available? I need to load the page again later with different dynamic content and the still-running Javascript conflicts with the same Javascript as it loads in again. And again.

I hope this description is understandable. I’m guessing that my problem is probably pretty simple and has to do with heirarchies that I have just yet to comprehend.

Thank you!

————- edit

Here is the Javascript in the loaded page. All of the classes and ids that it refers to exist within the loaded page. (code is adapted from tab behaviors coded by http://www.ilovecolors.com.ar/)

    //array to store IDs of our tabs
var tabs = [];
//index for array
var ind = 0;
//store setInterval reference
var inter = 0;

//change tab and highlight current tab title
function change(stringref){
    //hide the other tabs
    jQuery('.tab:not(#' + stringref + ')').hide();
    //show proper tab, catch IE6 bug
    if (jQuery.browser.msie && jQuery.browser.version.substr(0,3) == "6.0")
        jQuery('.tab#' + stringref).show();
    else 
        jQuery('.tab#' + stringref).fadeIn(200);
    //clear highlight from previous tab title
    jQuery('.htabs a:not(#' + stringref + 't)').removeClass('select');
    //highlight currenttab title
    jQuery('.htabs a[href=#' + stringref + ']').addClass('select');
}
function next(){
    alert("change");
    //call change to display next tab
    change(tabs[ind++]);
    //if it's the last tab, clear the index
    if(ind >= tabs.length)
        ind = 0;
}
jQuery(document).ready(function(){
    //store all tabs in array
    jQuery(".tab").map(function(){
        tabs[ind++] = jQuery(this).attr("id");
    })
    //set index to next element to fade
    ind = 1;
    //initialize tabs, display the current tab
    jQuery(".tab:not(:first)").hide();
    jQuery(".tab:first").show();
    //highlight the current tab title
    jQuery('#' + tabs[0] + 't').addClass('select');
    //handler for clicking on tabs
    jQuery(".htabs a").click(function(){

        //if tab is clicked, stop rotating 
        clearInterval(inter);
        //store reference to clicked tab
        stringref = jQuery(this).attr("href").split('#')[1];
        //display referenced tab
        change(stringref);
        return false;
    });
    //start rotating tabs
    inter = setInterval("next()", 3500);
});
  • 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-28T14:36:49+00:00Added an answer on May 28, 2026 at 2:36 pm

    The javascript is the same every time and only the content of the loaded page changes (I assume the content changes or else reloading it every time wouldn’t make sense); therefor I would take the script outside the file which is loaded in the div, and load it only once in the main page.

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

Sidebar

Related Questions

I am have a lot of code that I need to optimize and make
In my project I have a lot of code like this: int[][] a =
DirectDraw 7 is very old APIs but we have a lot legacy code written
I have a lot of C# VS2008 code that looks like this: new SqlParameter(@Description,
I have a solution that is missing a lot of code coverage. I need
Currently I have a lot of python objects in my code similar to the
I have a lot of shared C++ code that I'd like to use in
I have the following use case , lot of code which was tightly coupled
Ok, We have a lot of where clauses in our code. We have just
I have quite a lot of C++ legacy code modules from my colleagues, unfortunately

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.