jQuery $.cookie is not a function

前端 未结 7 1563
眼角桃花
眼角桃花 2020-11-27 15:12

I am trying to set a cookie using jQuery:

$.cookie(\"testCookie\", \"hello\");
alert($.cookie(\"testCookie\"));

But when I load my page, I

7条回答
  •  春和景丽
    2020-11-27 15:54

    You should add first jquery.cookie.js then add your js or jQuery where you are using that function.

    When browser loads the webpage first it loads this jquery.cookie.js and after then you js or jQuery and now that function is available for use

提交回复
热议问题