Hello, in this JavaScript video, I am going to show you what I'm going to show you dialog boxes. So there are three different dialog boxes. There's an alert, dialog box confirmation and a prompt dialog box. In a separate video I covered the prompt one, you're likely to get some input from the user and we just saw needed that earlier on tala Allah, ignore that one. And I'll just focus on the alert and confirmation. So this is quickly, you know, add some element.
I'm just gonna say, click me, click me. And so on click, I'm gonna say hello, click function for Hello. Okay, so a regular alert, you just put the keyword alert and go call some text in here what you want to do you there you can say Stop clicking me. Save that refresh. Click it if they stop clicking me, and he says we can, you know, click OK. And we can't do any, you know, anything out on the page at all till we've dealt with that alert. That's fantastic.
If you know the users done something, yeah, it might be right or wrong, but you just want to get the focus, prevent them from doing anything else, and make sure that they are aware of some new information. The next type of alert and all duplicate this math. I'll call this and this is a speller. I'll rename it just to alert and I'll actually rename this as well to be fair Confirm okay so the confirmation dialog box is slightly different and when you do it is confirmed and you say that man load obviously the original one still works and it up and do anything but looks like this one. This actually gives me a choice. So if you again you know 100% on the paid till I've dealt with this dialog box and it's saying no by manual Yes And so the question and you say yes or no or you're okay or cancel.
Okay my thinking how do we actually get the result of that it's actually really simple when this is initiated, this will return some sort of result. If we do vol and say value equals this Let's console dot log value. let's reload, click confirm, click Cancel. Go to the console. It says false. Let me show you again separately confirm okay or confirm.
Okay, so true, confirm, cancel, we get false. And honestly that's it. What I want you to do as a extra task is do some sort of conditional statement, check in the value of is true or false. And as a result, you don't do something. Instead, it just prints a true or false printout saying, well, you all Batman, you know, come to our party or no, you're not Batman, you know, go home, something along those lines. Thanks for watching.
If you have any questions, feel free to drop me a message and as usual, I look forward seeing you in the next video.