I would like to move one DIV element inside another. For example, I want to move this (including all children):
...
>
Old question but got here because I need to move content from one container to another including all the event listeners.
jQuery doesn't have a way to do it but standard DOM function appendChild does.
//assuming only one .source and one .target
$('.source').on('click',function(){console.log('I am clicked');});
$('.target')[0].appendChild($('.source')[0]);
Using appendChild removes the .source and places it into target including it's event listeners: https://developer.mozilla.org/en-US/docs/Web/API/Node.appendChild