Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
105
rated 0 times [  111] [ 6]  / answers: 1 / hits: 20311  / 13 Years ago, wed, december 7, 2011, 12:00:00

I have a hidden div in my page. I was wondering if there is a way to open it up in a separate window as opposed to a lightbox within the same page. There are a lot of ways to do this the lightbox method, but can't seem to find a way to do it in a separate window. I am running jQuery on the page



Lets assume this is the div:



<style>
#hidden {
visibility: hidden;
}

</style>

<div id=hidden>
<p>I am a hidden div</p>
<p>Hopefully i'll open up in a new window</p>
</div>


I tried the following method in jQuery, but it just ended up opening the same page



$(.button).click(function(){
window.open('#yeah');
});

More From » jquery

 Answers
47

You can use document.write to set the contents on your popup window:



var w = window.open();
w.document.write( $(#hidden).html() );
w.document.close(); //finish loading the page

[#88696] Tuesday, December 6, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronniem

Total Points: 584
Total Questions: 111
Total Answers: 111

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
;