[jQuery] Can $(document).ready() be put into a separate JS file?
Hi,
I have read a few tutorial docs, and they all state that $
(document).ready() be placed in a <script> tag on the current
document, like so:
<head>
<title>Test</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Add some code here
} );
</script>
</head>
When I try to move $(document).ready() to nav.js, I keep getting a
browser error message that says "$ is not defined."
<head>
<title>Test</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/nav.js" ></script>
</head>
Is there a way to load up the ready() function in a separate file? I
am using Jquery 1.2.1.
Thanks,
Stephen