Javascript – how to access iFrame parent page using jquery

iframejavascriptjquery

I have an iframe and in order to access parent element I implemented following code:

window.parent.document.getElementById('parentPrice').innerHTML

How to get the same result using jquery?
UPDATE: Or how to access iFrame parent page using jquery?

Best Solution

To find in the parent of the iFrame use:

$('#parentPrice', window.parent.document).html();

The second parameter for the $() wrapper is the context in which to search. This defaults to document.