Join Joe Chellman for an in-depth discussion in this video Set up functions, part of jQuery for Web Designers.
And the fact is, that a lot of browsers have weird compatibility issues, especially if you're not supporting only the very most modern browsers. So jQuery has another way of doing this. The dollar sign is the jQuery object as its normally aliased. It could also be spelled out as jQuery like this. So what we do, canonically, is use the jQuery function which is just named the dollar sign, and then inside that we pass our function where the action is going to take place.
So it'll look like this. So in other words, it's a named function called dollar sign, or jQuery, and then the one parameter passed to it is a function, and inside that function we know that the DOM has been loaded. This function will not fire until the DOM is ready. So as of jQuery 3, this is the canonical way that you do this. There are other ways that it's been phrased in the past that I want to show you as well. So one of those is to select the document first. So you pass in document as the parameter in to jQuery, thereby making a selection of the document, and then you'd use this method called ready, and its parameter would be the function where all the action takes place.
- When to use jQuery
- Installing jQuery
- Setting up functions
- Using jQuery classes
- Modifying the DOM
- Event binding
- Reading and setting values
- Integrating plugins
- Animating websites with jQuery