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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:29:16+00:00 2026-06-15T15:29:16+00:00

The structure of a webpage is like this :- <div id=’abc’> <div class=’a’>Some contents

  • 0

The structure of a webpage is like this :-

<div id='abc'>
  <div class='a'>Some contents here </div>
  <div class='b'>Some other contents< </div>
</div>

My aim is to add this after the class a in above structure.

<div class='a'>Some other contents here </div>

So that final structure looks like this :-

  <div id='abc'>
      <div class='a'>Some contents here </div>
      <div class='a'>Some other contents here </div>
      <div class='b'>Some other contents< </div>
    </div>

Can there be a better way to do this using DOM properties. I was thinking of naive way of parsing the content and updating.

Please comment if I am unclear in asking my doubt !

  • 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-06-15T15:29:16+00:00Added an answer on June 15, 2026 at 3:29 pm

    Create the desired element, give it the desired attributes, children, innerHTML, etc, and then append it:

    var parent = document.getElementById('abc'),
        ele = document.createElement('div');
    
    ele.setAttribute('class', 'a');
    ele.innerHTML = "Some other contents here";
    
    parent.appendChild(ele);​
    

    Fiddle

    You can be lazy and just set the innerHTML of #abc, but in my opinion this method is more flexible.

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

Sidebar

Related Questions

I've got a webpage structure like this one: <div class=total> <div class=menu> </div> <div
I have a html structure in my webpage as below : <div class=group_name>Group A</div>
I working on a web page which has a similar structure like this: <div
this is what an html structure of the webpage looks like: <body> <form> <input
I have a webpage looks something like this: <html> ... <div id=menu> ... <ul
I have the following directory structure : /script/x.js /includes/x.txt /1/2/index.html After hooking a webpage
//html structure <div id='outer'> <div id='inner'> </div> </div> I am adding some data to
Table structure goes something like this: Table: Purchasers Columns: id | organization | city
I have a webpage which has tab list, the HTML looks like this for
I am about to add some ad locations to my HTML webpage(ASP.NET). My sugestion

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.