I’m having troubles with the order of my code in my program. right now I have some things with in document.ready(function() { } ); and some things out side of it. Whenever I move anything (to organize or improve my code) I end up breaking something, I’m guessing because of either order of declarations or access levels (ie. something outside of document.ready(function {}); cannot access something inside of it.
Anyone have any insight as to where things should be located javascript wise?
Should everything be within document.ready(function() {});?
Is there any reason to have anything outside of document.ready(function() {});?
Is the code within document.ready(function() {}); inaccessible by outer code?
No, I think that the document.ready function must be only to initialize things, assign event handlers and so on.
Code reutilization, and better code organization.
Yes, the variables and objects created on the document.ready are inaccessible from the outer scope.