Can anybody tell me
is it possible to get and set values in localStorage
Here is my code
var TodoApp = {};
TodoApp.model = Backbone.Model.extend({
defaults: {
title : '',
done : false
}
});
TodoApp.list = Backbone.Collection.extend({
model: TodoApp.model,
localStorage: new Store("local")
});
var todoList = new TodoApp.list()
can i use todoList.localStorage.setItem() for this
localStorage is a key value persistence in the browser. All values must be strings. So you would stringify your JavaScript objects:
localStorage.setItem("myKey", JSON.stringify({foo: "bar"}));