Hello, in this jQuery video, I am going to show you how to select children in your selectors or how to only select Child Elements. And if we go to our code right here, what I'm going to do is actually get rid of this. I'm going to pick something and what I want to do is for every span, inside of the div, only immediate spans, I want to you know, I want to change the color. So I'm going to say dot CSS. And I'm gonna say color is red. Okay, so that's cool.
And I need to now apply the selector. So to do this, you put debt which is the parent, greater than, and then the element the child element. So this could be an ID, this could be a class, it could be any other sort of select assign with this. So this just say for all spans that are immediately within any days, apply this CSS color for the node, we get everything as red. Okay, sorry. Let me put this here.
And there will be blood with every spans that are within this within a div. And as you can see, this is within a div as well. So we don't want to actually do that. So what we want to actually do maybe if I change this to a p tag, they no longer before reload. As you can see, this is no longer read span isn't because it's within a p tag immediately within a pita, even though that's the day it needs to be a direct child of it and he applies to this affect children. Another thing that you can do, where you just affect all children of a particular element.
So what I'm going to say is all children have the diff of the of a did. You just have to specify the parent element. And that could be again a selector based on ID class. First ID, you know, anything like that. It doesn't really matter. I don't think dot CSS is the font size to 20 pixels.
Again, I don't know 20 pixels, reload, see what we hear. So this has applied to every single child inside of it. And the reason is supplied it to this as well, is because it's applied to the paragraph. Tag, and that is the parent of this. Therefore, unless this has its own style, it will get applied to it as well. So that's how you apply any sort of, you know, it doesn't have to be CSS code, nothing you do something to or select any sort of children, just based on the parent element or children doesn't matter.
It doesn't matter the type. But if you want to do it based on, you know, a child and then any immediate children, this is how you do it. That's how you select children within jQuery. Thank you for watching, and I look forward to seeing you in the next video.