I tried making a reset button to delete everything but when you refresh page the list reappears...Any ideas?
http://jsfiddle.net/y8Uju/12/
EDITL: Sorry, you are right, stupid me I forgot to change my storage's name...duh..haha...thanks a lot! I am not very familiar with html 5, still learning it.
var saved = JSON.parse(localStor开发者_如何学编程age["numbers"] || "[]");
for(var i = 0; i < saved.length; i++) {
storage.removeItem('saved[i]');
add(false);
}
localStorage
has two ways to remove data:
storage.removeItem('key'); // remove one item
storage.clear(); // remove everything
精彩评论