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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:43:26+00:00 2026-06-13T01:43:26+00:00

I am trying to create a JavaScript-based application which only needs to work in

  • 0

I am trying to create a JavaScript-based application which only needs to work in IE8 and 9.

This is a simplified description of the problem:

<div id="A" style="display:none">
<div id="a1">content of a1</div>
<div id="a2">content of a2</div>
<div id="a3">content of a3</div>
...goes on
</div>

<div id="B">
<div id="b1"></div>
<div id="b2"></div>
<div id="b3"></div>
...goes on
</div>`

I have a checkbox for each div under div “A”.

I need a simple JavaScript function that will copy, or delete, the content of the divs under div “A” to those under div “B” depending on which of the checkboxes are checked.

For example, if checkbox “a1” is checked, the content of div “a1” will get copied to div “b1”, or delete the content of “b1” if the box is unchecked.

Simple as that is, although I can’t figure it out, the whole div “B” will be then copy-pasted to an email, so the div “B” cannot contain any hidden elements. I can not use textarea.

  • 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-13T01:43:27+00:00Added an answer on June 13, 2026 at 1:43 am

    Modified Markup and Javascript code. Please note the use of class attribute in the checkbox element to find out the source and destination divs.

    HTML

    <div id="A" style="display:none">
    <div id="a1">content of a1</div>
    <div id="a2">content of a2</div>
    <div id="a3">content of a3</div>
    </div>
    
    <div id="B">
    <div id="b1"></div>
    <div id="b2"></div>
    <div id="b3"></div>
    </div>
    
    <input type="checkbox" class="1">
    <input type="checkbox" class="2">
    <input type="checkbox" class="3">
    

    Javascript

    $(document).ready(function(){
        $("input[type=checkbox]").click(function(){
           var source= $("#a" + $(this).attr('class'));
           var destination= $("#b" + $(this).attr('class'));
           if($(this).attr('checked')=='checked')
              $(destination).html($(source).html());
           else     
               $(destination).html("");
        });
    
    });
    

    http://jsfiddle.net/7qmQM/1/

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

Sidebar

Related Questions

I am trying to create a Javascript/Jquery based application that will eventually go into
I'm having a problem trying to create a Javascript function that checks all the
I am trying to create a simple Javascript text editor that only makes paragraph
I am trying to create a form using only JavaScript. I mean create a
i am just trying to create a link which execute some JavaScript in stead
I am trying to create Facebook based login using Javascript. Once a person clicks
I trying to create a points calculating system with javascript, but the problem is
I am trying to create a location based search application. I need to display
I'm trying to create a html5 and javascript based welcome display/kiosk for a building
I'm trying to create an HTML form (using JSP) which contains Javascript buttons (rather

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.