0

i have read this answer

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

You can have multiple ones, but it's not always the neatest thing to do. Try not to overuse them, as it will seriously affect readability. Other than that , it's perfectly legal.

But this is not the duplicate of that question,but with reference to that question i have to ask

  1. whether this type of implementation affect the pageLoad time of the page

  2. will it need any http requests for that

  3. do it have any drawbacks
Community
  • 1
  • 1
Sajad Karuthedath
  • 14,987
  • 4
  • 32
  • 49

2 Answers2

0
  1. Not more than attaching another listener to any other event. So no.

  2. No, because of the fact the $(document).ready(...) is just a listener to the "ready" event it's no more different than binding several .on("click", ...) to a DOM element.

  3. It depends, as long as the $(document).ready(...) listeners are modular an has no dependencies upon another theirs nothing strictly wrong about it. But I would argue to only use one function for readability sake...

A. Tapper
  • 1,261
  • 8
  • 17
0

You can have multiple ones, but it's not always the neatest thing to do. Try not to overuse them, as it will seriously affect readability. Other than that , it's perfectly legal. See the below:

http://www.learningjquery.com/2006/09/multiple-document-ready

vignesh.D
  • 766
  • 4
  • 18