Hello, in this jQuery video, I'm going to show you how to get and set values. So for example, in our HTML, I create a input. text for example. Awesome. This simple ID for now, this value right here so far, we were to reload. We got this value in there.
When we click it, we want to retrieve whatever value is in there. And that is extremely useful when you are creating some sort of submission form. So to do that, Wasn't click already set up. So I'm gonna say bow equals dollar you need to retrieve or select, I should say the element. And you can do that however you want. I'm keeping it simple when Id dot Val, and David and then if we were to console log console dot log Well, before to reload it, so click me before we change this slightly appropriately located it okay 74 to get rid of it, it updates as well.
Everybody Click me, he gets the latest value. If you want to set the value However, what you could do, maybe once you click this click me button, maybe some sorts of form and I'm sure you see on submission forms. Once you submit it, if successful, he deletes all the values. So you can either delete them or set a value by doing dollar for connecting. That's the most important part first. Go Go.
And now, before I say that man coming, criminals should be where I click that, you can see it has changed. Ignore that, because I did the console long before the change itself forward to click it, it will get it with level. If you want to essentially, you know, empty, you just put you just provide an empty string. And if we're below click that you don't need to put a space that has no deleted data. So that's how you get and set values on input elements. For example, If you have any questions, feel free to pop me a message and unusual.
I look forward to seeing you in the next tutorial.