2

I saw a jquery function call in one of the website where the function is called like

var exampleFunction = function() {
    console.log ( " running " );
}

$(exampleFunction);

And it is called like $(exampleFunction); Is this fine to use this ? Its working though but i have not seen this type of coding style.

1 Answer 1

5

The $(function) is short for $(document).ready(function). So exampleFunction will be called when the dom is loaded

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.