How can i style an alert box ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i style an alert box ?

Good Morning from my country, how can i style an alert box ? is it similar to the basic style that we have learn CSS or it must have a specific code ?

17th Apr 2018, 1:18 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
11 Answers
+ 4
Session storage can also be used for this task , but must be tested on regular browser, coz file access not supported on SoloLearn. session Storage API also works like Local storage with the difference that sessionstorage expires after session ends i.e browser closed , whereas localStorage will stay until it is not cleared explicitly //store data like this sessionStorage.setItem("name", "value"); //retrieve that stored data like this sessionStorage.getItem("name"); so minor changes ( local to session) in above code to make it session Storage
18th Apr 2018, 3:15 AM
Morpheus
Morpheus - avatar
+ 2
Ok
17th Apr 2018, 2:00 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
+ 2
local storage will come handy for this task , but must be tested on regular browser, coz file access not supported on SoloLearn. it's very easy actually //store data like this localStorage.setItem("name", "value"); //retrieve that stored data like this localStorage.getItem("name"); https://code.sololearn.com/WT514EAUL617/?ref=app
18th Apr 2018, 2:22 AM
Morpheus
Morpheus - avatar
+ 1
No you don't understand me i mean that i still learning Loop and While loop so i don't know lessons after that.
17th Apr 2018, 2:00 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
+ 1
Sorry for late, thanks i want ask you something how can i make it display one time for example if user opened application after download must display a message but i need to add ( never show again ) so what i will use to do that ?
17th Apr 2018, 3:44 PM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
+ 1
instead of using the built in browser alert prototype you could make your own element that is conditionally rendered whenever you trigger a function. or you could import a library that makes alerts really easy, like sweet alerts. here is my code for an example https://code.sololearn.com/WOxhcDBREK6j/?ref=app
5th May 2018, 7:14 PM
Logan
Logan - avatar
0
sorry, i meant welcome box but i can't explain i remembered that when i try to make an alert box the style changes it have a difference between android mobiles and IOS and google chrome, so can you explain to me how can i code a welcome message ( box ) but i need it to display for the first time not always.
17th Apr 2018, 1:29 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
0
English is my second language so it's hard for me to explain my problems welcome box for example when you download a new app it's display a message that have a welcome or new features content so it calls welcome or ulment box
17th Apr 2018, 1:48 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
0
Yes, this is what i need i know now how can i code it but i want it display one time when user enter the application
17th Apr 2018, 1:49 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
0
Ok, can you give me an example code plz because i still learning JS in Loop and While Loop i didn't finish it ?
17th Apr 2018, 1:55 AM
Abdelrahman Ashref
Abdelrahman Ashref - avatar
0
Thanks, you helped me a lot. so i will learn a bit about Cookies. thanks again for Welcome box help.
17th Apr 2018, 11:27 PM
Abdelrahman Ashref
Abdelrahman Ashref - avatar