[英]jquery cookie variable is not getting updated
我的代碼如下
選擇jquery datepicker我正在調用以下代碼
$.removeCookie("log_dt");
$.cookie("log_dt", $(this).val());
alert($.cookie("log_dt"));
應該刪除以前設置的cookie值並放入新值,但它不起作用我怎么能修復它,我出錯了什么
為了獲得新值,您不需要刪除cookie,只需執行以下操作即可重置值。 你的代碼看起來很好所以請檢查$(this).val() 。
$.cookie("log_dt", "New Value");
這是因為保存cookie的路徑,錯誤的cookie被取代了
$.removeCookie("log_dt",{path: '/path', domain: domain}); this worked
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.