Is $ (document) .ready () called after loading script js files in the body?
If I put $ (document) .ready () in the head in a script element that accepts a callback function that uses the functions declared in the file, its script element is loaded into the body as follows:
<!DOCTYPE HTML> <html> <script src="jquery.js" type="text/javascript"></script> <script> $(function(){ hello(); }) </script> <head> </head> <body> <script src="http://somewhere/helloFuncDeclaration.js" type="text/javascript"></script> </body> </html>
Is it right to do this and guarantee that helloFuncDeclaration.js will be loaded before calling the hello () function?
source share