Page 1 of 1

How do I enable a DIV to be removed on click?

Posted: Thu Jun 05, 2014 3:53 am
by simonmlewis
I want to give users "updates", via a DIV at the top of the screen. But for them to be able to click an 'X' to close it permanently.

It's kinda like sites do it for "this site uses cookies".

How does it work??

Re: How do I enable a DIV to be removed on click?

Posted: Thu Jun 05, 2014 6:18 am
by Celauran
You mean like this? http://jsfiddle.net/NzfSJ/

Re: How do I enable a DIV to be removed on click?

Posted: Thu Jun 05, 2014 6:39 am
by simonmlewis
I do - but does that make it disappear for the whole time you are on the site?
I'm using one *.inc file for tickets. and need to let Support know of developments. but once they know, via that DIV, I want them to be able to click the X, and it's gone permanently. Until I update it again. Or perhaps until they login and create a new session.

Otherwise, if the page was reloaded, would that not reappear?

Re: How do I enable a DIV to be removed on click?

Posted: Thu Jun 05, 2014 6:45 am
by Celauran
Yes, this would reappear on page load. Sounds like what you need is more complex than simply hiding a div, though. You'll need to track what each user has seen. Cookies can handle that temporarily, but you may even want to persist that data so they aren't seeing a bunch of old notices again after having cleared their cache.

Re: How do I enable a DIV to be removed on click?

Posted: Thu Jun 05, 2014 7:31 am
by simonmlewis
Or just abandon telling them. lol.
Thanks.