当我打开的子窗口的文档已加载并准备就绪时,我试图收到通知。这似乎不起作用:
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
});
我必须做什么?
最佳答案
你试过这个吗? —
$(win.document).ready(function() {
$(win.document).contents().find("...").doStuff();
});
This question讨论非常相似的事情。重复?
关于jQuery:在子窗口上接收文档准备就绪(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4842432/