Last Updated : Jul 1, 2023
As, there are many ways to change background color of alert box.
Today, let us see our this article now.
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
- Here, in the code above we do nothing, just create an alert box, and type some text in this and create a button also. After that we use display none and apply some css on it to give it a creative look whereas display none is used to hide our alert box.
- After that we use jQuery in which we say when you click on button, function gets called and inside function we get the value from alert box and when user click on the button created inside alert box the alert box disappears. We hope that you understand this code easily.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
At last in conclusion, here we can say that with help of this article we are able to change background color of alert box using div.