Nest html tags inside html

I am creating a platform on which people can send emails - to display a preview of emails, I use the div below the form where they can enter a message.

So, the general structure looks like this:

<html>
    <body>
         <form>
              <!-- Form to enter email here -->
         </form>
         <div>
              <!-- Email preview here -->
              <html>
                   <!-- Email content, updated everytime user types something --->
              </html>
         </div>
    </bod>
</html>

However, the simple use of html tags inside the html document itself seems to confuse every browser - also, this does not seem very clean.

Since the sent email would be its own html document, it would be easiest to put all this in a div.

How can I do this in a correct, clean way?

+5
source share
2 answers

iframe. - src.

HTML:

<iframe name='preview'></iframe>

JS ( DOM- )

var doc = document.preview.open("text/html","replace");
doc.write('<html><body><p>this is some content</p></body></html>');
doc.close();
+1

, , . - chalenge. iframe. , .

0

All Articles