moving javascript to file causes error

I have some javascript included in my html head and I think it runs on the page load. It is something like
$(function() {
;
;
});

if I move it to a file and then call it with:
<script type="text/javascript" src="/scripts/capture.js"></script>
it reports an error. How do I format the function if I move it to a file?
Gary SamuelsPlant ManagerAsked:
Who is Participating?
 
Tom BeckCommented:
Not much to go on. Is the error because of the doc ready function you posted or is it coming from deep inside the script?

Here's a dumb question. Does this markup, <script type="text/javascript" src="/scripts/capture.js"></script>, occur on the page AFTER your jQuery library include? If not, that would cause an error.
0
 
10023Web site maintenance and designCommented:
You broke the link to the     /scripts/capture.js   file when you move the the html file that includes the path in  the head script
0
 
Gary SamuelsPlant ManagerAuthor Commented:
I cut the javascript from the html header and pasted it into a file. Now in the header I'm calling <script type="text/javascript" src="/scripts/capture.js"></script> which is good because there is also a <base href="http://www.mydomain.com" />.
0
 
Gary SamuelsPlant ManagerAuthor Commented:
Not a dumb question at all. YES, I placed the call before loading the JQuery library. So I guess I get the dummy award today.
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.