I'm trying to get notified when the child window I'm opening has its document loaded and ready. This doesn't seem to work:
win = window.open(href, 'test', 'width=300, height=400');
win.focus();
$(win.document).ready(function() {
// Ok, the function will reach here but if I try to manipulate the
// DOM it doesn't work unless I use breakpoints
$(this).contents().find("...").doStuff(); // nothing happens
});
What do I have to do?
Have you tried this? —
$(win.document).ready(function() {
$(win.document).contents().find("...").doStuff();
});
This question discusses something very similar. Duplicate?
I had a similar problem and for me the .load event on the window did work, the .ready did not. So you may try:
win = window.open(href, 'test', 'width=300, height=400');
$(win).load(function() {
$(this).contents().find("...").doStuff();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With