HI, I have a iframe in my web site and i need to write something in to a div outside of the iframe when a button is clicked, this is not working with the regular
$('#id').html("write something");
any ideas how to do this? Thank you very much
We can use the object tag in HTML to embed external resources in the webpage. We can use the tag to display another webpage in our webpage. The object tag is an alternative to the iframe tag in HTML. We can use the tag to embed different multimedia components like image, video, audio, etc.
HTML Iframe SyntaxThe HTML <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.
Set the iframe to the appropriate width and height and set the scrolling attribute to "no". If the area you want is not in the top-left portion of the page, you can scroll the content to the appropriate area.
$('#id', window.parent.document).html('write something');
Obviously this assumes that the parent and the iframe are on the same domain otherwise you will not be able to manipulate the parent from the child neither the parent will be able to manipulate the child (if they are not from the same family :-))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With