Using jQuery to echo text
- by susmits
Is it possible to use jQuery to echo text in place of a script tag? More precisely, is there a way to accomplish
<script type="text/javascript">
document.write("foo");
</script>
... without the use of document.write? I am not happy about using document.write after reading this.
I am aware that I could alternatively do this:
<span id="container"></span>
<script type="text/javascript">
$("#container").text("foo");
</script>
However, I'm interested to see if there's a way to do it without using a container element, preferably using jQuery.
Thanks in advance!