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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:18:32+00:00 2026-05-16T17:18:32+00:00

I have several vertically stacks divs and I want to have a div appear

  • 0

I have several vertically stacks divs and I want to have a div appear when I click a button within each of these divs. The div that I want to appear will be the exact same for each appearance with the exception of an id associating it with the outer div. How do I do this in Javascript?

I assume I should use the createElement() within Javascript, but how do I append it to the end of a specific element. Also, when creating an element, I have to hardcode the html in the Javascript file. Is there anyway to leave the element within the html design file. I want to seperate design from code as much as possible.

  • 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-16T17:18:32+00:00Added an answer on May 16, 2026 at 5:18 pm

    Clone Node

    var clone = myDiv.cloneNode();
    

    Example (live demo):

    HTML

    <div>
        <input type="button" onclick="functionClone(this);" value="Dolly"/>
        <input type="button" onclick="functionClone(this);" value="Dolly_1"/>
    </div>
    

    Javascript:

    functionClone = function(subject){
        var clonenode = subject.cloneNode(true);
        subject.value = subject.value + '\'s been cloned!';
        subject.disabled = true;
        insertElementAfter(subject, clonenode);
    }     
    
    insertElementAfter = function(subject, newElement){
        subject.parentNode.insertBefore(newElement,subject.nextSibling);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div with a table inside and several content divs in cells.
I have a design that has several divs at varying widths/heights and I need
I have a form which contains several checkboxes align vertically in a div. I
I have a <ul> containing several vertically stacked <li> . The <li> scroll within
I have several Views, text views, and a button that have the android:visibility=invisible attribute.
I have several pages to do with several table on each page. I've got
I have several thread pools and I want my application to handle a cancel
i have several classes with members called 'Id'. Originally i wanted to store these
I have several UILabels of various sizes on my Views. I want all the
I have a Delphi 2007 TRichEdit with several lines in it. I want to

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.