mhpreiman
10/17/2017 - 9:44 AM

document ready

jQuery

$(function() {

})

Javascript in HTML

<script>
(function() {

})();
</script>


All of the following syntaxes are equivalent:

$( handler )
$( function(){ handler } )
$( ).ready( handler )                
$( document ).ready( handler )
$( "document" ).ready( handler )
$( "img" ).ready( handler )

NB! Don't use the second one $( ).ready( handler )