JavaScript Web アプリで Cookie を削除する際に少し問題があります。このコードを別の関数で使用しましたが、問題なく動作しますが、何らかの理由で現在、Cookie の有効期限が実際には変更されていないため、何か明らかなことが不足している可能性がありますが、これが私のコード:
function deletetodo(obj) {
var checkboxID;
// get just the ID number of the checkbox.
checkboxID = obj.id.replace(/todo-status-/g, '');
// to make sure it's getting the right cookie ID (which it is)
alert(checkboxID);
// delete that cookie with the same ID number.
document.cookie = "todo-" + checkboxID + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT;';
}
私が持っている別の関数では、この同じコードが Cookie を削除し、関数の最後で小さな変更に置き換えられるため、奇妙です。
何か案は?ありがとう!