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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:06:37+00:00 2026-06-03T09:06:37+00:00

I have two div on my page. One is draggable and other is droppable

  • 0

I have two div on my page. One is draggable and other is droppable.

Draggable div:

<div id='drag'>
    <div id='one'>11111</div>
    <div id='two'>22222</div>
<div>

Droppable div

<div id='drop'>

</div>

I am using following jQuery code to append the contents of div ‘drag‘ to div ‘drop‘ on drop event of draggable div.

$(function() {
        $( "#drag" ).draggable();
        $( "#drop" ).droppable({
            drop: function( event, ui ) {
                $( this ).append( ui.draggable.html();
            }
        });
    });

Now what I want to do is , I don’t want to show the contents of div ‘two‘(which is inside div ‘drag‘) to the user. But still when a user drops the div ‘drag‘ on div ‘drop‘ , the content of both div ‘one‘ and ‘two‘ should get appended to div ‘drop‘.

So the user should see the content of div ‘drag’ as:(div ‘two’ is hidden)

111111

But after drop of div ‘drag’, the content of div ‘drop’ should be:

111111
222222

Please guide me how to hide the content of div ‘one‘ from user, but still use it on drop event.

  • 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-03T09:06:38+00:00Added an answer on June 3, 2026 at 9:06 am

    Slight changes in the markup and js script as follows

    <div id='drag' style="border:solid 1px blue;height:50px;">
        <div id='one'  >11111</div>
        <div id='two' ><span style="visibility:hidden;">22222</span></div>
    </div>
    
    
    <div id='drop' style="border:solid 1px red;height:50px;">
    
    </div>
    

    ​

    $(document).ready(function() {
        $("#drag").draggable();
    
        $("#drop").droppable({
            drop: function(event, ui) {
                $(this).append(ui.draggable.text());
            }
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two div on my page.One is draggable and other is normal. Draggable
I have two div's on a page: one floating left and the other right:
I have a page with the following two divs: <div id=searchResults> </div> <div class=postSearchOptions
In the following HTML page, I have a div, which contains two spans (
I have two div's one has textbox in it and other just plain text.
How to wrap one div around another? I have following two div ids: #course
I have two div element in my page aligned vertically. content of one div
So I have two div elements on my page, one directly on top of
I have two iframes on a page and one makes changes to the other
I have two jquery scripts on one page that both target on-site links via

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.