Reputation: 191
I'm opening an iframe(inside a pop up) from a page(say parent) and trying to hide the div element(whose id is iframeloading) of parent page from this iframe using the following code $(window.parent.document).find("#iframeloading").hide();
This works in ff but not working in IE7..Pls help
Upvotes: 1
Views: 842
Reputation: 21909
Most browsers in current use support an iframe onload
attribute (including IE5.5+, Firefox, Safari, Opera). If you want older browsers to do something once the document has finished loading into the iframe, you can include an onload handler inside that document. That document can then reference the containing document using the parent keyword.
Using traditional javascript methods with the onload
html attribute:
<iframe id="testFrame" name="testFrame" onload="hideLoading();" />
<script type="text/javascript">
function hideLoading() {
$("#iframeloading").hide();
}
</script>
Of course you can use jQuery framework to add this event properly:
<iframe id="testFrame" name="testFrame"/>
<script type="text/javascript">
$("#testFrame").load(function() {
$("#iframeloading").hide();
});
</script>
Upvotes: 1