Ask Your Question
0

How can I prevent the reset of the hide/show div on page refresh?

asked 2021-06-28 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-07-02 04:00:00 +0000

qstack gravatar image

There are a few approaches you can take to prevent the reset of a hide/show div on page refresh:

  1. Use localStorage or sessionStorage to store the state of the hide/show div. When the page loads, check if there is a stored value and use that to determine whether to hide or show the div.

  2. Use cookies to store the state of the hide/show div. When the page loads, check if there is a cookie set and use that to determine whether to hide or show the div.

  3. Use server-side scripting to retrieve the state of the hide/show div from a database or session variable. This approach requires server-side programming knowledge and may be more complex, but it allows you to store the state of the div across multiple visits to the page.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-06-28 11:00:00 +0000

Seen: 11 times

Last updated: Jul 02 '21