How can I make JavaScript (or jQuery) code only execute on the visitor's first visit and never again until a cookie expires or is removed?
For example: $('#example').hide();
How can I prevent this code from executing for 7 days for this visitor?
How can I make JavaScript (or jQuery) code only execute on the visitor's first visit and never again until a cookie expires or is removed?
For example: $('#example').hide();
How can I prevent this code from executing for 7 days for this visitor?
try this tut: http://www.electrictoolbox.com/jquery-cookies/ set a cookie on first visit, read it out on any subsequent visit and do something like:
if($.cookie.isset() == true) {
// do something
}
In order to do like this. you should use server scripting for additional help.
Eg. in PHP
<?php
if(isset($_SESSION['session_name'])){
?>
Your javascript or jquery code here
<?
}
?>