.ready()
methodThe .ready()
method in jQuery is used to run the code that need to wait for the DOM is fully loaded.
.ready()
method Syntax.ready(handler)
$( document ).ready(function() { });
is equivalent to
$(function() { });
// recommended