Hello, in this jQuery video, I am going to show you how to set an attribute. So here we've got code how to get an attribute. So you have some sort of selector, and this was selected that you want to dot att RG short for attribute, then you put the name of the attribute in there, and that returned value. But what happens is, if we were to do this instead, per comma, then something else, this will actually set it. So if there's only one parameter, you'll return the value for this attribute. If there's two parameters, the first one will again just be the name or like the exact attribute, and then the second value will be the value that you assign to it.
So if we have a look, we've got a total of Hello, world. And I'm actually just going to create a proton. Let me Honestly, all I have to do, ID, you know, save that in the JavaScript file. I selected some dollar hash. I covered some of the events such as click yet, but we've covered selectors, and I'll be covering all this in a separate video function. So we are going to run this code and this code is just going to be this.
It is simply going to change the actual view the title attribute of every div which in this case is only the one and only To change it to epic. So if I save that if I go to elements go to body, it says hello world, everything saved, reload, go by. Okay, that's a total of hello world for click it. As you can see it's changed to Epic depth. So that's how you change the attribute of a HTML element using jQuery. Really simple.
One parameter just gets the value of the attribute, two parameters, set the value of that attribute. Simple is a lemon squeezy. If you have any questions, feel free to shoot me a message and I look forward to seeing you in the next video.