I want to get the text of an externally loaded JavaScript file.

i.e. … this works …
<script id="inline" type="text/javascript">
… some javascript code
</script>

<script>
alert(document.getElementById("inline").text);
</script>

the second script will output the text of the first script.

… this does not work
<script id="external" type="text/javascript" src="somescriptfile.js"></script>

<script>
alert(document.getElementById("external").text);
</script>
the second script simply outputs an empty string.

I need this solved.

Thank you and happy bidding!

Tags: , , , , , ,