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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:06:40+00:00 2026-05-27T02:06:40+00:00

I have two DIV elements on a webpage. I want to remove inner html

  • 0

I have two DIV elements on a webpage. I want to remove inner html of DIV B, if inner HTML of DIV A is added via a third party script which is not under my control.

What is the best way to achieve that in JS?

  • 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-27T02:06:41+00:00Added an answer on May 27, 2026 at 2:06 am

    You could just remove inner html of DIV id=b when you apply inner HTML to DIV id=a?

    Or if that’s not possible, you could track the innerHTML of DIV id=a with a timer and see when it gets populated:

    window.onload = function(){
    var a = document.getElementById("a"),
        b = document.getElementById("b"),
        c = setInterval( function(){
    
            if( a.innerHTML && a.innerHTML.length > 0 ) {
            b.innerHTML = "";
            clearInterval(c);
            }
    
        }, 50 );
    };
    

    Note that the html structure must be like this:

    <div id="a"></div>

    I.E. no whitespace.

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

Sidebar

Related Questions

I have two HTML elements inside a div. I want to display them in
I have two elements on my page (two 'cancel' elements). <div unselectable=on class=x-grid-cell-inner x-unselectable
I have two <div> elements that I want to position side by side like
I have two DIV-elements, which are assigned an array called stack using data() .
I have a set of HTML reports that each contain two DIV elements with
I have two DIV elements. HTML looks like this: <div id=first><div id=second></div></div> The CSS
I have two div elements that are twins (i.e. their dimensions and contents are
I have a list with two <div> s in every <li> and I want
I have two div elements, box_1 and box_2: <div id="box_1" style="position:absolute;top:0;left:0;width:500px;height:500px;border:1px solid gray;z-index:2;"> </div>
I have two <div> elements: <div id=hidden> <div id=hideitem> <input id=item5 type=radio class=item name=item

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.