Unclear where $(document).ready goes.
I have been using jQuery off/on for a little over a year now and I am still confused about triggering a jQuery script. I understand that there is a sequence of library scripts that are called within the head of the DOM, but I am looking at the trigger to run the script.
I have seen $(document).ready( function() { blah blah blahhh; }); in multiple ways that works:
1-- as the script closest to the end of the header.
2--After the footer of a HTML 5 page, before the end of the body.
3-- In an external js file. Script located closest to the end of the header.
I have been trying to make the 3rd option work for me due to the fact the jQuery stays separate from the HTML DOM. I learned this style from codeacadamey.com and it works with the examples on their tutorials.
The weird thing is I cannot get the to work locally.
The 2nd option worked for me last year. It was also the first way I learned how todo it while I was in school.
The first idea are what jQuery UI examples for the .draggable() effect uses.
I assume that 1st option is the 'standard' way because the jQuery site shows an example, but there are multiple locations for the jQuery script '$(document).ready();' to run.
Is there a standard way to run '$(document).ready();'? Or does it even matter? W3C standard when working with jQuery?
Thanks in advance!