the ready() shortcut doesn't work all the time for frames/popups. Use the onload instead:
$(popup.document).load(function(){ console.log($('#test', $(popup.document.body)).length); }); - ricardo On Nov 20, 7:47 pm, dickles <[EMAIL PROTECTED]> wrote: > very simple codes not run right. test for when popup window is > loaded... > > i try everything, very frustration! please for you to helps, 1,000 > thanks in advance to you! > > from parent window: > > <script type="text/javascript"> > var popup = window.open('test.html', 'client_window', > 'height=400,width=700'); > $(popup.document).ready(function() { > console.log($('#test', $(popup.document.body)).length);}); > > </script> > > from 'test.html': > > <html> > <head></head> > <body> > <div id="test">yes you can</div> > </body> > </html> > > console.log() says the length is 0 if the popup is a new browser > window. If the popup is already open and you refresh parent page, the > length is 1. ready() is not working as i expects!