views:

496

answers:

4

I have a simple page (index.html) with a div:

I am populating that div with some easy jquery commands:

$("#email").html("[email protected]");

Is there a way to populate a similar div on a popup? I like to use popups for debugging reasons, but I don't want to reload the popup each time the main page refreshes.

In other words, can jquery search for an element on a different window?

It's a long shot, but I thought I'd ask.

A: 

This isn't really what you're asking, but I think it's a near-substitute.

In Firefox it's possible to use Firebug (Opera has Dragonfly, and Chrome has its developer tools) and, from jQuery, use:

console.log("message to display in the console, plus: " + variable_names)

to display debug messages. These console.log() commands will cause js errors when the console is not active, though.

David Thomas
A: 

So, you want to launch a separate browser, loading a separate webpage, to display more information. ???

DO NOT DO THAT !!

It's slow, and most users find it rather annoying. So annoying, that nearly everyone of them will be using some form of popup blocker, which you are now expecting them to disable, just to see some content on your page. Most will find this extremely annoying.

Since you are already using jQuery, why not just use jQuery UI's Dialog plugin. This turns a hidden DIV on you page into a popup. It's looks better than an old-fashioned popup, runs faster, and since it's part of your same page, solve the problem you are asking about..

UPDATE: Sorry about the rant -- I didn't see the comment about using this for debugging purposes -- but really, using a popup for debugging is a even worse idea, even if you are the only one being annoyed. (have you considered alert() )

James Curran
A: 

To answer the question, no, it's not possible as far as I know.

What you CAN do, is read the content from the popoup window, though.

var popup = window.open('url', 'params');
var dom = popup.document.body;
for(i in dom){
    console.log(dom[i]);
}

You can't, however, change the contents.

Alex
+1  A: 

If it is just about debugging i will not recommend a popup for that. You can go for blackbird [http://www.gscottolson.com/blackbirdjs/] or firebug console [console.log ( 'blah blah' )]

Otherwise you can check out
http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/

and at last, if you just want to stick to popups, this might help you

http://swip.codylindley.com/popupWindowDemo.html

Rakesh Juyal
Ah...Blackbird... That was the one I was going to recommend --- except that I forgot it's name....
James Curran