jQuery jQuery 2.2.3 and earlier


Example

These are all equivalent, the code inside the blocks will run when the document is ready:

$(function() {
  // code
});

$().ready(function() {
  // code
});

$(document).ready(function() {
  // code
});

Because these are equivalent the first is the recommended form, the following is a version of that with the jQuery keyword instead of the $ which produce the same results:

jQuery(function() {
  // code
});