[jQuery] question about loading javascript into an element after dom is ready
I'd like to load a js file into a specific location but it replaces
the page with what is being written out. I suspect there's a fairly
obvious answer (maybe it can't be done). Here's a basic version of the
code and I would like it to write 'here i am' in the dom after <div
id='jt'></div>. Currently, it replaces the dom. Also if I take it out
jquery and place it at the end, it still replaces the page:
<html>
<head>
<script type='text/javascript' src='/jsource/jquery.min.js'></
script>
<script type='text/javascript'>
$(document).ready(function(){
alert("I am ready");
var pom=document.createElement('script');
var jt=document.getElementById('jt');
pom.setAttribute('type','text/javascript');
pom.setAttribute('src','write.js');
jt.appendChild(pom);
});
</script>
</head>
<body>
<b>Before things started</b> to make senese:
<div id='jt'></div>
here are other things here
</body>
write.js:
document.write('here i am');