Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is using javascript document ready twice in one document ok?

I have a header on my webpage that contains the some javascript for some jquery plugins i am using. These plugins are used on a bunch of pages so I just include them in the header document that is included in everyone one of my pages.

There is one page however that I would like to include some other javascript but is only needed on this one page. can i use the document ready function a second time on the same page or is that poor form?

I don't want to include the javascript on everypage as it is not needed and would be a waste to load on every page.

like image 688
Sackling Avatar asked Jan 19 '12 20:01

Sackling


1 Answers

YES

The jQuery docs are clear that this is fine.

like image 94
Adam Rackis Avatar answered Sep 27 '22 21:09

Adam Rackis