Question #6278   Submitted by Answiki on 06/22/2022 at 07:05:46 PM UTC

How to replace $(document).ready(()) in pure JavaScript ?

Answer   Submitted by Answiki on 06/22/2022 at 07:05:42 PM UTC

The best way to replace the jQuery method $(document).ready() in Vanilla JS is:

document.addEventListener("DOMContentLoaded", function() {
  // code...
});

8 events in history
Question by Answiki 06/22/2022 at 07:06:41 PM
How to replace $(document).ready() without jQuery ?
Question by Answiki 06/22/2022 at 07:06:22 PM
How to replace $(document).ready() in Vanilla Js?
Question by Answiki 06/22/2022 at 07:06:12 PM
How to replace $(document).ready() in pure JavaScript ?
Question by Answiki 06/22/2022 at 07:05:46 PM
How to replace $(document).ready(()) in pure JavaScript ? replaced by #6279.
Answer by Answiki on 06/22/2022 at 07:05:42 PM

The best way to replace the jQuery method $(document).ready() in Vanilla JS is:

document.addEventListener("DOMContentLoaded", function() {
  // code...
});

Answer by Answiki on 08/17/2021 at 03:59:24 PM

The best way to replace jQuery $(document).ready() in Vanilla JS is:

document.addEventListener("DOMContentLoaded", function() {
  // code...
});

Answer by Answiki on 08/17/2021 at 03:59:06 PM

The best way to replace jQuery $(document).ready() in Vanilla JS is:

document.addEventListener("DOMContentLoaded", function() {
  // code...
});

Question by Answiki 08/17/2021 at 03:57:34 PM
How to replace $(document).ready(()) in Vanilla Js? replaced by #6280.
# ID Query URL Count

Icons proudly provided by Friconix.