jQuery:在子窗口中接收文档ready() [英] jQuery: receive document ready() on child window

查看:143
本文介绍了jQuery:在子窗口中接收文档ready()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开的子窗口的文档加载并准备就绪时,我试图收到通知。这似乎不起作用:

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
    });

我要做什么?

推荐答案

你试过了吗? -

$(win.document).ready(function() {
    $(win.document).contents().find("...").doStuff();
});

这个问题讨论了非常相似的东西。重复?

This question discusses something very similar. Duplicate?

这篇关于jQuery:在子窗口中接收文档ready()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆