jQuery syntax: function inside parentheses after dollar sign

jquery

Solution

`$(function(){...})` is a shortcut for

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

See the API docs

http://api.jquery.com/ready/

- `$(document).ready(handler)`

- `$().ready(handler) (this is not recommended)`

- `$(handler)`

Problem

I have seen a syntax where one puts a function inside parentheses which follow a dollar sign like this: ``` $(function(){...}); ``` What does this mean in jQuery? What does the function do?

Original source

Related problems