I am using an User Control/Html Editor in which there is an Iframe, since I can’t change the value of it from javascript directly, I want to just append a text in the Iframe’s body tag.
The Problem is I can get the Iframe element but how can I get it tag? also how can I write a text to it?.
For Example: The Iframe looks something like this:
<iframe>
<html>
<body>
----Here I want to write a text-----
</body>
</html>
</iframe>
Using vanilla JS only:
Using jQuery (which will eliminate any cross-browser issues) (untested):
Because of security restrictions imposed by the same-origin policy, the iframe must be in the same domain as the parent page for either of these to work.