Reputation: 495
I'm using the Zurb jQuery Modal script to bring up a popup box. when the user clicks the "close" x, I want to set a cookie so they don't see the popup again for 15 days.
For some reason, I can't get this to work, can someone help?
here is the live example: http://www.realcartips.com/test/modal/demo.html
And here is the jQuery code I'm using:
$(document).ready(function() {
if (!(jQuery.cookie("rct"))) {
setTimeout(function(){
$('#myModal').reveal();
}, 1000);
}
});
$(".close-reveal-modal").click(function () {
$.cookie("rct", 1, { expires: 15, path: '/' });
});
</script>
Edit: I forgot to mention I'm using the cookie jQuery plugin
Upvotes: 0
Views: 382
Reputation: 15338
try this:
$(".close-reveal-modal").live("click",function () {
alert("fired");
$.cookie("rct", 1, { expires: 15, path: '/' });
});
Upvotes: 2