samedi 27 juin 2015

jQuery - object dissapears as soon as I put it in another page

Couldn't find about this problem, I guess it's not really a problem, just I don't know how to it. On the event of click on a certain div, I want to open it a new tab. I managed to do it in the following code, but what happens is the original div disappears from the original page and is showed only in the new tab, I'm not quite sure why this is happening, but I though about cloning the object - but wasn't successful.

This is the relevant code: open new tab on click:

$(document).on("click", ".button", function(){
    window.toSend = $(this);   
    window.newTab = window.open("test.html", "_blank");  

add the object to the new tab:

var data = parent.window.opener.toSend;
    $(".clickedButton").html(data);

Any solutions? or first, why is this even happening? thanks!




Aucun commentaire:

Enregistrer un commentaire