I'm making a modal with register, login and forgot password forms, and I'm playing with divs by hiding and showing them. I did this trick of cloning the content when closing the modal but none of the elements inside responds to the jQuery assigned to them.
This is the code that clones:
var login_modal = $('.md-modal.login-modal');
var originalState = login_modal.clone();
login_modal.find('.md-close').click(function(){
login_modal.replaceWith(originalState);
});
This is the an example of the code that doesn't work after cloning:
$('#email-register').click(function() {
$('#multi-login-box').hide();
$('#register-box').show();
});