Skip to content

Commit

Permalink
Update examples/todos/todos.js
Browse files Browse the repository at this point in the history
fix js bug: Uncaught TypeError: Cannot read property 'localStorage' of undefined 
  • Loading branch information
fancyoung committed Aug 29, 2012
1 parent 38991ab commit 74ec1e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/todos/todos.js
Expand Up @@ -131,9 +131,12 @@ $(function(){
// Close the `"editing"` mode, saving changes to the todo.
close: function() {
var value = this.input.val();
if (!value) this.clear();
this.model.save({title: value});
this.$el.removeClass("editing");
if (!value){
this.clear();
}else{
this.model.save({title: value});
this.$el.removeClass("editing");
}
},

// If you hit `enter`, we're through editing the item.
Expand Down

0 comments on commit 74ec1e5

Please sign in to comment.