I am writing a one page web-application in JavaScript
with jQuery
. I add my JavaScript
source and jQuery
to the HTML page and register my function to be invoked when the the page is fully rendered.
<script type="text/javascript" src="lib/jquery-1.8.0.js"></script> <script type="text/javascript" src="src/myapp.js"></script> <script type="text/javascript">$(MyApp.onReady)</script>
It works but I do not like to have code inside HTML.
Now I wonder if I can get rid of the last line. Is it absolutely necessary to invoke $(MyApp.onReady)
in the HTML?