Embed HTML tag in JavaScript
6 answers
Is the E4X what you are looking for? This allows you to embed XML / XHTML into your JavaScript, for example:
var someXml = <div><b>Some Text</b></div>;
I doubt what you need, but this is the only way to do what you ask. Also, I don't think it works in Internet Explorer. Eliminate this, it only works in Firefox.
If this is not what you want, use document.write()
as suggested by others.
Edit: E4X is now deprecated and has been removed from newer versions of Firefox. Don't use it. You have to use jQuery as it tells me below, or just create elements via document.createElement
and friends and inject them into the document.
+2
a source to share