So I have a function that writes a string into a div. The string is declared as content, which consists of html code, like this:
<h2>This is a test result</h2>
<script type="text/javascript" src="example_content.js"></script>
<script type="text/javascript"> document.write(example_content); </script>
where example_content.js :
example_content = '<p>some text some text some text some text some text</p>'
+ '<p>some more text....</p>'
+ '<hr />'
+ '<p>End of text</p>';
Problem is, instead of getting this in the div:
<h2>This is a test result</h2>
<p>some text some text some text some text some text</p>
<p>some more text....</p>
<hr />
<p>End of Text</p>
I end up, literaly, with this:
<h2>This is a test result/h2>
<script type="text/javascript" src="example_content.js"></script>
<script type="text/javascript"> document.write(example_content); </script>
Is there a way to avoid writting the script tag as a string ? but as an actual script ?
Thanks for any help in advance :)
document.write(example_content);inside the js file?