Reputation: 153
I am learning about HTML5 these days.
Here comes trouble when I want to remove just one of the data in the localStorage.
I know a method called clear()
to remove anything, but what can I do if I just remove one of the data by its key?
Upvotes: 15
Views: 18419
Reputation: 647
sessionStorage.removeItem('UserName');
localStorage.removeItem('UserName');
Upvotes: 64
Reputation: 32286
Does delete window.localStorage["foo"]
not work for you for some reason?
Upvotes: 2