Possible Duplicate:
Can you have multiple $(document).ready(function() sections?
Is it OK to have multiple calls to $(document).ready on the same page? If so how is the order that the code is run in resolved and does this have any implications
I am using jQuery in my rails app. I have several levels of javascript used through the application, all of which use jQuery.
For example I have some default code that fades out Flash Notices in my application.js I have a projects.js file that is included in all Project model views, and I have a project/edit.js that is included only in the view rendered by the edit action.
In all three js files I am using:
$(document).ready
{
//Do something
}