G
G
galyamov_marat2016-01-22 18:01:32
JavaScript
galyamov_marat, 2016-01-22 18:01:32

How to remember script after page refresh?

How to make "memory". If the user clicked on the button, then a class is added to the element. When updating the added class should be saved, how to implement it? I was looking for a solution on the Internet, but everything is very difficult to describe to us

$(".view-option .fa-th-list").click(function(){
 $(".new-files").addClass("view-list");
 $(".view-option .fa-th-list").css("color", "black");
 $(".view-option .fa-th").css("color", "#72AD0C");
 });

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill, 2016-01-22
@quant78

try in cookies

H
HAbRAhabp, 2016-01-25
@HAbRAhabp

I would use localStorage for this task

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question