Alex Rivera | Logout

Can you have multiple $(document).ready(function(){ ... }); sections?

Asked 2009-08-25T11:44:27.827
255

If I have a lot of functions on startup do they all have to be under one single:

$(document).ready(function() {

or can I have multiple such statements?

Edit
Report

2 Answers

15

Yes you can easily have multiple blocks. Just be careful with dependencies between them as the evaluation order might not be what you expect.

answered 2009-08-25T11:47:54.920
10

Yes it is possible to have multiple $(document).ready() calls. However, I don't think you can know in which way they will be executed. (source)

answered 2009-08-25T11:47:29.320

Your Answer