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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:52:51+00:00 2026-05-27T06:52:51+00:00

I am using jQuery 1.6.2. In a master page, I open up several divs

  • 0

I am using jQuery 1.6.2.

In a master page, I open up several divs that will later be populated with info through the use of buttons:

<input type="button" id="ButtonOne">
<input type="button" id="ButtonTwo">
<input type="button" id="ButtonThree">
<div class="SectionDiv" id="DivOne"></div>
<div class="SectionDiv" id="DivTwo"></div>
<div class="SectionDiv" id="DivThree"></div>

I make a call to populate the divs like this:

$("#ButtonOne").click(function() {
    $("#DivOne").load("FileOne.html");
});

When I popule a div, I want to get rid of everything in the other divs. I have done this two different ways. Like this:

// METHOD ONE
$("#ButtonOne").click(function() {
    // UNLOAD ALL DIVS
    $(".SectionDiv").load("BlankPage.html");
    // LOAD THE DIV THAT NEEDS TO BE LOADED
    $("#DivOne").load("FileOne.html");
});

// METHOD TWO
$("#ButtonOne").click(function() {
    // UNLOAD ALL DIVS
    $(".SectionDiv").html("");
    // LOAD THE DIV THAT NEEDS TO BE LOADED
    $("#DivOne").load("FileOne.html");
});

In method one, I load the div with a page that has no content, a completely empty page. In method two, I use html(“”) with the same effect(?).

While these two methods have the same visual outcome, does one have a distinct advantage over the other for killing existing variables in the divs, or detaching elements better from the DOM, or anything? Is one faster in certain environments than the other? Does one hog more resources than the other?

  • 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-27T06:52:51+00:00Added an answer on May 27, 2026 at 6:52 am

    Method one causes a request to get the blank page for no reason (because you know it is blank, there is no need for a request). So essentially method two is the optimized version of method one because it saves the useless additional HTTP requests.

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

Sidebar

Related Questions

I'm using jquery to validate an asp.net form (content within a master page). The
I have a view using a master page that contains some javascript that needs
I am using jQuery session in my master page. Anything I'm missing? Code: <script
I am creating Menu in the master page using JQuery. i am passing the
Using jQuery, is there a way to select all tag that reference a specific
I have a master-detail page, in which I use GridView to display multiple rows
I have a problem with a master page containing a asp:textbox that I'm trying
Master page contains 2 columns: Left column is JQuery UI accordion whose width can
I've set up a number of accordions on a page using the jquery accordion
I have 4 content placeholder from my master page and I am using the

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.