How to use jQuery cookies to remove a welcome message?

Discussion in 'Programming' started by lazlow, Oct 18, 2011.

  1. #1
    Hi, so I'm trying to make a welcome message disappear when clicked on close and set the cookies to remember it so after reload the message doesn't appear again.

    <script type="text/javascript">
    $(document).ready(function(){				   
    	$(".pane .delete").click(function(){
    		$(this).parents(".pane").animate({ opacity: 'hide' }, "slow");
    	});
    
    });
    </script>
    Code (markup):
    Please help.
     
    lazlow, Oct 18, 2011 IP
  2. mrmuggles

    mrmuggles Greenhorn

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #2
    Something like :
    $.cookie("clicked", "true", { path: '/' });
    in the ".click" function
    then either you do it in JQuery:
    if ($.cookie("example") == "true") {
    $(".pane").hide();
    }
    But you'll probably see it disappear quickly when you load the page
    OR you hide it in PHP (or whatever your server language is) before the page is sent to the client.
     
    mrmuggles, Oct 18, 2011 IP
  3. lazlow

    lazlow Peon

    Messages:
    137
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Still can't figure how to make this work. I'm a total noobs when it comes to js/jquery :/

    Can anyone else help?
     
    lazlow, Oct 31, 2011 IP