$(document).ready equivalent without jQuery
Asked 07 September, 2021
Viewed 1.3K times
  • 61
Votes

I have a script that uses $(document).ready, but it doesn't use anything else from jQuery. I'd like to lighten it up by removing the jQuery dependency.

How can I implement my own $(document).ready functionality without using jQuery? I know that using window.onload will not be the same, as window.onload fires after all images, frames, etc. have been loaded.

30 Answer