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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:33:03+00:00 2026-06-17T11:33:03+00:00

I’m using jQuery to append (move) a div into another div . This is

  • 0

I’m using jQuery to append (move) a div into another div. This is working fine, but now I’m trying to make it a function and I’m running into some problems.

I have a few div‘s, two called #geregeld and #niet_geregeld. One called #content_vragen and a class called .container_vragen.

The .container_vragen is initally placed in the #content_vragen. In the .container_vragen is a button with this code:

 $('.submenu').on('click','.groen',function() {
            $(this).closest('.container_vragen').fadeOut(400, function() {
                $(this).closest('.container_vragen').css({overflow : 'hidden', color : 'green'});
                $(this).closest('.container_vragen').appendTo("#geregeld");
                $(this).closest('.container_vragen').fadeIn(400);
            });
        });

This action puts the .container_vragen in the #geregeld div. This works fine. But I want the user to be able to put the .container_vragen back into the #content_vragen div and this is proving to be a problem.

The code I’m using to do that is this:

function appendToContent_vragen() {
        $(this).closest('.container_vragen').fadeOut(400, function() {
            $(this).closest('.container_vragen').appendTo('#content_vragen');
            $(this).closest('.container_vragen').css({overflow : 'hidden', color : 'black'});
            $(this).closest('.container_vragen').fadeIn(400);
        });
    }

This also works. The problem is selecting the right div in the #geregeld div.

$('#geregeld , #niet_geregeld').on('click',function(){
        $('.container_vragen', this).click(appendToContent_vragen);
    });

If I use this code I have to click twice on the .container_vragen in #geregeld to get to the function appendToContent_vragen and obviously I want the user to click only once.

I have small jsFiddle with the code I’m using: http://jsfiddle.net/hE7Gm/

  • 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-17T11:33:04+00:00Added an answer on June 17, 2026 at 11:33 am

    I’m getting confused by all the Dutch, but in this block:

    $('#geregeld , #niet_geregeld').on('click',function(){
        $('.container_vragen', this).click(appendToContent_vragen);
    });
    

    you maybe have two problems. The first is that the inner call to .click does not make a click, but is registering a new click handler, just like .on('click', ...) does. I can’t tell if that’s a real problem or not because I can’t tell what the site is really supposed to do.

    The second problem is setting this when appendToContent_vragen is called. If, as I suspect, you just want to call that function immediately (without a second click)

    $('#geregeld, #niet_geregeld').on('click', function() {
         $('.container_vragen', this).each(appendToContent_vragen);
    });
    

    This works because .each will call the supplied function with this equal to the current element.

    Also, in your animation functions there’s no need for all those .closest() calls – you already know that the passed element is a .container_vragen, so:

    function appendToContent_vragen() {
        $(this).fadeOut(400, function() {
            $(this).appendTo('#content_vragen')
                   .css({overflow : 'hidden', color : 'black'})
                   .fadeIn(400);
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am using JSon response to parse title,date content and thumbnail images and place

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.