I have a div on my page that acts as a shell to store other divs. The page loads and the shell is hidden & empty. On a jQuery event I show the shell and fill it with the triggered div. More often than not, the triggered div happens to be a form.
if I do this:
$('#lb_content').html($('#' + div_id).html());
that duplicates the form and makes validation/submit difficult - right?
my work around is to store an global variable:
var container_emptied = '';
so when I show the shell I do this:
var content = $('#' + div_id).html();
container_emptied = '#' + div_id;
$(container_emptied).empty();
$('#lb_content').html(content);
and when I hide the shell I do this:
$(container_emptied).html($('#lb_content').html());
$('#lb_content').empty();
am I over complicating this?