Hello, in this jQuery video, I am going to show you chaining and changing is really, really awesome. It allows you to essentially group together on one single, you know, line of code, multiple, no effects, multiple, you know, methods that you can use, you know, for your selector. So if I create a button, great law enforcement, I'm gonna have an ID. I'm gonna call this epic, epic picture. Saved that what we've got so far, and if I go to here, I need to detect them. So click know that picture.
Chain. Click on more about events such as the click event. Please check out this series. So now what we need to do is select all of our you know elements that we want to call methods on and I'll just do it Darth Vader now we'll just return the one element or you can do multiple elements as long as you want to design and the selected can be as advanced or as simple as needing to be a no doc here is where you put something like slowly enough fade as they fade phase two so this will fade to a certain property so 0.5 for example. Okay, so why didn't work Let me have a quick look what happened. Say to Wildwood I meant to be a you know, a parameter which is meant to be Speed is self.
And you can put slow fast in milliseconds, simple and slow. And now if I reload it, as you can see faded. Okay, maybe I have a normal button, Nova call as well. And the next call could be potentially to do with what could I do next? Or actually what I could do, it may be to me my way put it on camera before I can modify the CSS for example. Maybe I want to modify the background color background Background color.
I'm getting confused the background color. So for some reason, it just didn't look right in my head. Okay, now you propel on Commerce only if you specify multiple, and now the color sent to us being blue. So I reload it, click me change it to blue and fade it, what we can actually do is combine them. So instead of having it like this or leave it, I'll leave this here commented out, just so on the GitHub source code page, you can see what is exactly happening. If I get rid of the semicolon, and I put the fade to at the end so it's all on one line now doesn't look like it is broken down.
If I extend my text editor, you can see it is technically on one single line of code. No fully loaded allows me to chain the you know functions together and you can go crazy, you can add a lot of changes much chaining as you want. So this is really, really useful for having multiple calls like this with multiple selectors, you know, they are inefficient as well, because you get in, you know, the terminal the item the elements multiple times this way is Goran wants to set up a one on one for TFS. We want to fade to 50% opacity and anything else you want to do just put up the jQuery method name that you can apply to a selector. Any parameter that needs no problem is in your book. So for example, function name, any parameter in here they need the dog than any other function that you want, as well.
That's chaining in jQuery, including method chaining. If you have any questions, feel free to drop me a message. And as usual, I look forward to seeing you in the next awesome video.