What is the difference between $(document)

The difference between $(document) and $(window) in jQuery involves the timing of when the DOM is fully loaded. $(document) refers to the DOM document object and is used to execute code when the HTML document is ready. $(window) refers to the browser window itself and is often used for actions related to the viewport and resizing events.

jQuery, $(document), $(window), DOM ready, viewport, browser events
Learn the differences between $(document) and $(window) in jQuery to effectively manage DOM readiness and browser events.

        $(document).ready(function() {
            console.log("DOM is fully loaded");
        });

        $(window).on('resize', function() {
            console.log("Window has been resized");
        });
    

jQuery $(document) $(window) DOM ready viewport browser events