As is evident when the document gets loaded in the client browser,
$(function(){
some code here
});
takes over.
Say I have two JavaScript files main.js
and style.js
main.js is for the functionality and style.js for some hypothetical styling when the page loads. I want both the files. I include them in my index.html first style.js then main.js both of them start with:
$(function(){
some code here
});
My question is, what is the order of execution of document.ready
is it that main.js and style.js start doing things parallely or is it sequential, once style.js has finished what it should do then main.js takes over??
Well you can have multiple document.ready
but that affects the readability of the code. More has been explained here