I'd like to embed an html tag in Javascript, between the script> tag
Thanks
I'd like to embed an html tag in Javascript, between the script> tag
Thanks
You can't do that. tags can contain just text (usually javascript).
You can't. If you want the Javascript to write HTML, you'll have to use document.write()
.
Is E4X what you're looking for? It allows you to embed XML/XHTML within your JavaScript, like this:
var someXml = <div><b>Some Text</b></div>;
I doubt that's what you need, but that's the only way you can do what you're asking. Also, I don't think it works in Internet Explorer. Scratch that, it only works in Firefox.
If that's not what you want, use document.write()
, as suggested by others.