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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:49:46+00:00 2026-05-15T00:49:46+00:00

I am not just a newbie with Javascript. I am developing a simple site

  • 0

I am not just a newbie with Javascript. I am developing a simple site to get my hands on web programming. The web site is simple and structure is like this:

  1. A simple ul/li/css based navigation menu
  2. Sub pages are loaded in “div” using jQuery, when ever user click appropriate menu item.
  3. Some of the sub-pages are using different jQuery based plugins such as LightWindow, jTip etc.

The jQuery function that loads the sub-page is like this:

function loadContent(htmlfile){
    jQuery("#content").load(htmlfile);
};

The menu items fires loadContent method like this:

<li><a href="javascript:void(0)" onclick="loadContent('overview.html');return false">overview</a></li>

This loads a sub-page name “overview.html” inside the “div”.

That’s it.

Now this is working fine but some of the sub-pages using jQuery based plugins are not working well when loaded inside the “div”. If you load them individually in the browser they are working fine.

Based on above I have few qustions:

  1. Most of the plugins are based on jQuery and sub-pages are loaded inside the “index.html”
    using “loadContent” function. Do I have to call

    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

    on each and every sub-page?

  2. If a page is using a custom jQuery plugin, then where do I call it? In “index.html” or on the page where I am using it?

  3. I think whatever script you will call in “index.html”, you don’t to have call them again in any of the sub pages you are using. Am I right here?


All my sub-pages are similar to this one:
This is screenshot.html. Working fine when I load locally in a browser but not working when loaded using jQuery’s load() function inside “index.html”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <script type='text/javascript' src='js/prototype.js'></script>
        <script type='text/javascript' src='js/scriptaculous/scriptaculous.js'></script>
        <script type='text/javascript' src='js/lightview.js'></script>
        <link rel="stylesheet" type="text/css" href="css/lightview.css" />
    </head>

    <body>
        <h3 style="text-align:left;">Screenshots</h3>

        <div align="center">
            <a class="lightview" href="images/ss_win1.png" title="Title"><img src="images/ss_win1_thumb.png" alt="" class="whiteborder"/></a>
            <a class="lightview" href="images/ss_win2.png" title="Title"><img src="images/ss_win2_thumb.png" alt="" class="whiteborder"/></a>
            <a class="lightview" href="images/ss_win3.png" title="Title"><img src="images/ss_win3_thumb.png" alt="" class="whiteborder"/></a>
        </div>
    </body>
</html>
  • 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-15T00:49:48+00:00Added an answer on May 15, 2026 at 12:49 am

    Typically, for plugins, you will need to re-init them after you programmatically replace the part of the DOM on which they have been applied, e.g.:

    function loadContent(htmlfile){
        jQuery("#content").load(htmlfile), function(response) {
    
            // this gets executed after the response has been inserted into the DOM
            jQuery(response).find("#someElement").fooPlugin();
        });
    };
    

    For event handlers, you can simply use live or delegate to ensure that they remain intact after the elements to which they are attached get replaced. The (live) manual says:

    Attach a handler to the event for all
    elements which match the current
    selector, now or in the future.

    Example:

    $("a").live("click", function() {
        alert("this will alert even after this anchor has been replaced via ajax");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 424k
  • Answers 424k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Never heard of FreeBasic before but looking at the help… May 15, 2026 at 11:59 am
  • Editorial Team
    Editorial Team added an answer <iframe> elements have a load event for that. How you… May 15, 2026 at 11:59 am
  • Editorial Team
    Editorial Team added an answer How about newmean <- function(X, ...){ args <- as.list(substitute(list(...)))[-1L] z<-list(X)… May 15, 2026 at 11:59 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.