Jquery has a ready
method:
$(document).ready(function(){
// my code
})
It will execute my code when dom is ready.
I have a question, if I put all my scripts after </body>
, e.g.
<html>
<body>
// all kinds of html tags
</body>
<script src="/path/to/jquery.js"></script>
<script src="/path/to/all-javascript-compressed-in-one-file.js"></script>
</html>
Do I still need to write $(document).ready()
? Is the dom already ready
after </body>
?