Reputation: 315
I have looked around for similar questions and I couldn't find an answer...
I'd like for one particular page of my web site to import a file ("clock.js"):
<script type="text/javascript" src="clock.js"></script>
and, on load, to run the function tick() from that page.. in the body of the document.
I know I am supposed to do it this way:
$(document).ready(tick);
But it doesn't work and I suspect it's because these lines of code are in the middle of the document.
Any suggestions?
Upvotes: 0
Views: 133
Reputation: 31033
apparently the code should work. you can try
jQuery.getScript("clock.js",function(){
tick();
});
Upvotes: 2