How do you move html from one div to another with Jquery without breaking javascript
Posted
by KallDrexx
on Stack Overflow
See other posts from Stack Overflow
or by KallDrexx
Published on 2010-05-08T00:02:20Z
Indexed on
2010/05/08
0:08 UTC
Read the original article
Hit count: 278
JavaScript
|jQuery
I have two divs for different sections of my webpage, a working and a reference section. One is fixed size, the other is variable sized and they are vertically stacked. I am trying to design it so that if you want to work on something in the reference pane, you click a link and it swaps all the data between the two panes. My idea was to do the following:
var working = $("#working_pane").html();
var ref = $("#reference_pane").html();
$("#working_pane").html(ref);
$("#reference_pane").html(working);
The problem with this, is it seems that any javascript referenced inside of these panes (for example, in place editors) get broken upon switching. No javascript errors occur, it's just that nothing happens, like the javascript ties are broken.
Is there any to move the html without breaking the javascript contained?
© Stack Overflow or respective owner