Permalink
Browse files

Fix event handling.

  • Loading branch information...
1 parent 5ba3b9a commit 9659547156fc8eca09e3096d931854429056545e @pyykkis pyykkis committed Oct 29, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 examples/backbone/js/app.js
@@ -17,7 +17,7 @@ $(function() {
el: $('#application'),
render: function() {
- this.$('.customers').render(customers.toJSON(), {
+ this.$('.customers').render(this.customers.toJSON(), {
delete: {
index: function(params) { return params.index; }
}
@@ -34,7 +34,8 @@ $(function() {
this.customers.fetch();
},
- addCustomer: function() {
+ addCustomer: function(event) {
+ event.preventDefault();
this.customers.create({
suffix: this.$('.new-customer .suffixes').val(),
name: this.$('.new-customer .name').val(),
@@ -44,7 +45,7 @@ $(function() {
},
deleteCustomer: function(event) {
- customers.at(event.target.getAttribute('index')).destroy();
+ this.customers.at(event.target.getAttribute('index')).destroy();
}
});

0 comments on commit 9659547

Please sign in to comment.