Hello everyone , I was absent from the platform for quite a long time but here I am back with some new things.
So follow along and I ll be covering all the basics in future as well so stay tunes and for now just follow along the post.
I will demonstrate that how simple it is to Generate a Alert Message.
We will also Discuss real life use of the Alert Messages in the post at the end.
Requirements to follow along this post
If you are familiar with basics of html you can continue to read this this tutorial.
So You can use any editor for example VsCode , Brackets , Sublime text or even a simple text editor pre installed into your computer.
I will upload the image below so you can see if you have done any mistakes in your code.
So just perform the following steps :
- Create a proper html structure i/e html , head , body , meta tags.
- At the end of the body tag create a script tag , for doing so just write script enclosed in <> , just like you define any other tag for example head or body tag in html.
- Inside the script tag write the following code :
window.alert("Welcome to Blurt.world");
- Thats it you are done , now when you will save and run you file with any of the browsers you will see an alert message popping up automatically.
What is window.alert amd why is it used in web development...?
You can use this in many places for example if you have created a form where user enters his details and submit it. you can show the alert message of , "Invalid Data Provided" if the details enter by the user is not correct.
You can also simply use alert("your message here") instead of window.alert("your message here") and it will just work fine.
Now i suggest you try creating multiple alert messages one after the another and see what happens.
Output in the browser
you can see the output below for your code.
That's it for this post , feel free to ask any question regarding the post.