I am using the Bootstrap Alerts boxes, and would like these boxes to "remember" if they have been closed. This way when a user logs in to the members area and closes an alert; the next time they visit the site the alert is still gone.
Is there any way to do this?
<div class="alert-message success" data-alert="alert">
<a class="close" data-dismiss="alert" href="#">×</a>When I click × I'd like this to never appear again.</div>
You probably will have to store that preference in the cookies or on the server itself. A good read can be found in another SO thread.
For storing cookies Basically, what you have to do is to implement javascript around your codes. For simplicity, I utilise jQuery and a jQuery cookie plugin.
If you are using the server option, you have to code hideMe.php to:
Disclaimer: These codes are to give you an idea how it can be done. However, there is no gaurantee that it will work as it is, as I did not test the code.
Notes:
I wrote a basic solution for my website, that works well for my needs:
The JS to use after the DOM is ready: