Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Thank you, that has done the trick! :) Will upvote when I can. Commented May 31, 2017 at 19:05
  • 1
    @BrendonWells Don't forget to mark the answer :) Glad it fixed the problem! :D Commented May 31, 2017 at 19:07
  • You can also just take the function definition outside of jQuery(function($) { ... }). Function definitions don't need to wait until the DOM is loaded. Commented May 31, 2017 at 19:27
  • @Barmar Yes, but it does use the $ function coming from the callback. Commented May 31, 2017 at 19:43