# Backbone.js Tutorial - 14 - (Collections) Events (ok)

![](https://2726517656-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M1E4Gk2ppVKb4olmnun%2F-MS2KiWpZbnAxZubtJql%2F-MS2OjO-6aFqVOxYpyBR%2FScreenshot_1.jpg?alt=media\&token=88be05b0-18c0-4a5d-beff-bbec4107b66c)

C:\Users\Administrator\Desktop\gulp\app.js

```
StudentModel = Backbone.Model.extend({
  defaults: {
    name: "unknown"
  }
});
StudentCollection = Backbone.Collection.extend({
  model: StudentModel,
  initialize: function() {
    this.bindEvents();
  },
  bindEvents: function() {
    this.on("change:name", function(model) {
      console.log("Change name: " + model.get('name'));
    }),
    this.on("add", function(model) {
      console.log("Add studient: " + model.get('name'));
    }),
    this.on("remove", function(model) {
      console.log("Remove studient: " + model.get('name'));
    })
  }
});
jQuery(document).ready(function($) {
  var jony = new StudentModel({ name: "Lionel1", id: 1 });
  var vicky = new StudentModel({ name: "Lionel2", id: 2 });
  var studentGroup = new StudentCollection([vicky]);
  studentGroup.add([jony]);
  studentGroup.remove([jony]);
  vicky.set({ name: "Edit 1" });
  displayCollectionContents("After: ", studentGroup);
});
function displayCollectionContents(string, collection) {
  console.log(string + " " + JSON.stringify(collection.toJSON()));
}
```

