I have an iframe and I wrote this code
window.parent.document.getElementById('parentPrice').innerHTML
to access parent element. How to get the same result using jquery?
UPDATE: Or how to access iFrame parent page using jquery?
I have an iframe and I wrote this code
window.parent.document.getElementById('parentPrice').innerHTML
to access parent element. How to get the same result using jquery?
UPDATE: Or how to access iFrame parent page using jquery?
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.
how to access iFrame parent page using jquery
window.parent.document.
jQuery is a library on top of JavaScript, not a complete replacement for it. You don't have to replace every last JavaScript expression with something involving $.
If have an iframe inside my HTML document. I would like to access with jQuery the parent document of the iframe. The following Code works fine in Firefox. But Safari just stays inside the iframe and doesn`t parse the parent element??? (latest Safari version 4.0.4) Thanks for your help.
var attr = $("html",window.top.document).html();
Thanks $('#parentPrice', window.parent.document).html();
this works for me
in parent window put :
<script>
function ifDoneChildFrame(val)
{
$('#parentPrice').html(val);
}
</script>
and in iframe src file put :
window.parent.ifDoneChildFrame('Your value here');