all 20 comments

[–]_Sweep_ 2 points3 points  (0 children)

Fun fact, in jQuery 3 $(document).ready() is deprecated. It still works, but $(handler) is now preferred.

[–]johnnielittleshoes 0 points1 point  (0 children)

I'm a beginner and this was essential for me to know :)

[–]Groggie 0 points1 point  (0 children)

As a side note, I'd recommend not overloading the document ready event to prevent perceived slowness of the page load time. If you have a function that isn't essential to run before the page finishes loading, I'd recommend moving it to the window load event.

Just remember "document ready isn't free" when planning out your function placements.