0

hi i am creating popup plugin in wordpress. For that i want to set cookie when the user click on submit button so the user when reload the page the popup will not show again and again until the cookie is not remove. This is my jQuery code

     $( "#sfpsubmit" ).click(function() {
                    $.cookie("sfpopup", "sf_popup", { expires: 1 });
                });

        if ($.cookie('sf_popup')) {
                $('#myModal').modal('hide');
            }   
        else{
        setTimeout(function(){
            $('#myModal').modal('show');
        }, 3000);
        }

I don't know how to set cookie using jQuery in WordPress so i am using this way

jayant rawat
  • 305
  • 4
  • 19
  • 1
    Do you have a problem with the code? Have you checked the console for errors. Note that the `$.cookie()` method is not part of the standard jQuery library, and you will need to include that additional script in your page. – Rory McCrossan Mar 10 '16 at 13:14
  • yes it is saying in console that ` $.cookie is not a function` – jayant rawat Mar 10 '16 at 13:16
  • In that case you need to include this library in your page: https://github.com/js-cookie/js-cookie – Rory McCrossan Mar 10 '16 at 13:16

0 Answers0