Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

targeting the parent window using jQuery

Here is the sample code which I am not able to solve. I did it using javascript, but when I am doing using jQuery, I do not able to target the element.

Script :

var element = window.parent.document.getElementById('iframeOne');
//this is working fine      

But i want to do using jQuery. So how can I target the element?

like image 812
naresh kumar Avatar asked Dec 06 '25 03:12

naresh kumar


1 Answers

Perhaps you want to do something like this

$('#iframeOne', window.parent.document);

Another way to do it

window.parent.$("#iframeOne");

Another way

$("#iframeOne", top.document);

If you know the name of the parent window, you can also do

$("#iframeOne",opener.document)

Here opener is the name of the window.

Cheers!!

like image 101
bhb Avatar answered Dec 08 '25 17:12

bhb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!