How to keep button active after i refresh the page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to keep button active after i refresh the page?

I have created 3 buttons: Button1, Button2, Button3. Button1 is active all the time (so it is what i need) Button2, when you click it, Will apear a prompt dialog which ask you 3 questions. If they are True, you can open the Button 3. So, what i need is : I what to keep enabled The button3 forever if i answered at those questions from Button2. If you can help me, Will be great. 😌

18th Sep 2020, 7:37 PM
Bogdan Constantin
Bogdan Constantin - avatar
2 Answers
+ 6
Bogdan Constantin You can use local storage. It will keep data in browser session until you didn't quit the browser but remember you need to destroy it after finishing your work so that you can check again for other questions.
18th Sep 2020, 7:42 PM
A͢J
A͢J - avatar
0
in js way:- Use document.onload event and in add a fxn to add a class of active (define it in css) using btn1.classList.add("active"); So document.onload will add that class on btn as the document loaded / indirectly refresh as refresh will aslo load the document.
19th Sep 2020, 5:33 AM
Divya Mohan
Divya Mohan - avatar