Question

I am trying to find a way using jquery without cookies to display a block and click it to hide() and not show again.

It is a temporary under construction div on my page.

Is there any way to click it to close, which is easy enough using jQuery, then not have it load again? For it won't on the other pages?

Was it helpful?

Solution

Load the div with a conditional check of a bool variable. So in pseudocode:

var HasBeenViewed = false;

If (!HasBeenViewed)
{
  show div;
  HasBeenViewed = true; 
}

Edit: for it not to work on other pages you would need to use a cookie or some sort of state persistence somewhere, either on the client or the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top