gpt4 book ai didi

javascript - jQuery - 新窗口上的选择器

转载 作者:行者123 更新时间:2023-12-01 01:47:16 24 4
gpt4 key购买 nike

我无法访问使用 $window.open() 打开的新窗口中的元素:

var printWindow = window.open(window.location.href, 'Imprimer', config = 'width=1024, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');

printWindow.onload = function() {
printWindow.find(".navbar").remove();
}

这里,行 printWindow.find(".navbar").remove(); 不起作用。我尝试了几个 jQuery 选择器,但未能访问弹出窗口中的“.navbar”。

顺便说一下,这个应用程序中也使用了AngularJS,也许它与我的问题有关。

预先感谢您的帮助。

最佳答案

printWindow 没有 find() 方法,它不是 jQuery 集合?

var printWindow = $window.open(window.location.href, 'Imprimer', config = 'width=1024, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');

printWindow.onload = function() {
$(printWindow.document.body).find(".navbar").remove();
}

关于javascript - jQuery - 新窗口上的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20224137/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com