Hello, in this jQuery video, I am going to show you how to get and set CSS properties in jQuery. First of all, let's just create a div and also just put some text in there hello world. I'm also going to apply an inline style recommended that you use a separate style toggle mode, preferably a separate style sheet, but just keeping simple Briony here and I'm going to say color. So if I run that now we get a red text. Simply put, that's pretty simple stuff. And we're on going to do is show you how to get the CSS property or something.
So you don't have to have a selector but we're going to use a selector don't say dollar so when any David click on the click event, if you Want to know more about events such as click and other events, I'll recommend checking out the events part of this series. So in here, when I say, dollar, this, this will just select the current div that is clicked, not just all it is. And if we do dot CSS, open curly bracket, and if we put this a color, which is the property and let's just console log in and see what we get. And if we click it, it prints out the RGB value of 25500255, red, G, green, B blue, so red, so that's fine that you know, fully on and if I were to change this to blue, for example, you'll see that the last value will be 255 and the first value will be zero.
I click that, there we go. Okay, if you want to set a value, really simple Don't be console sorry, you just this thing essentially, who, whatever sort of selector you're using this or something like this Stormer dot CSS. And now what you do is put the, the name of the property that you will modify for your CSS same as the difference in E book comma, provide an extra parameter, which is the value itself. So if say for this, I perhaps I'll just put some random values like oh 567 Fs. I don't know what colors can produce, but let's find out. So click it.
Oh, you pretty sure have a Bluey color is a slightly light blue object again, we'll get the new value so that is the new RGB value. So that is how you get value if you want to a more comprehensive list of the different To know CSS values that you can get, I will provide a link to that. So feel free to peruse that at your own leisure. If you have any questions, feel free to shoot me a message and unusual. I look forward to seeing you next video.