Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8843943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:21:44+00:00 2026-06-14T11:21:44+00:00

I am learning Backbone and I am trying to figure out what library I

  • 0

I am learning Backbone and I am trying to figure out what library I am getting the ‘on’ function out of. I thought it was jQuery, but if so I am not understanding the API. Could someone please explain the ‘on’ function or link me to some docs. The first parameter is the event. The second parameter is the function being called. What does the last ‘this’ refer to (I assume the calling class) and why is it needed? Here is my code straight from Addy Osmani, this is the AppView:

    initialize : function() {
        this.input = this.$('#new-todo');
        this.allCheckbox = this.$('#toggle-all')[0];
        this.$footer = this.$('#footer');
        this.$main = this.$('#main');

        window.app.Todos.on('add', this.addOne, this);
        window.app.Todos.on('reset', this.addAll, this);
        window.app.Todos.on('change:completed', this.filterOne, this);
        window.app.Todos.on("filter", this.filterAll, this);

        window.app.Todos.on('all', this.render, this);

        app.Todos.fetch();
    },
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:21:46+00:00Added an answer on June 14, 2026 at 11:21 am

    The on method in this case is coming from Event module of Backbone. It accepts three parameters – the event name, function and the context.The context decides what the value of ‘this’ should be inside the function.

    Todos.on("filter", this.filterAll, this); your just asking that inside the function filterAll the value of ‘this’ should be your views instance

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning Backbone.js and am trying to figure out whether it's possible to have
I am learning backbone. I am trying to use on event for change. But
I'm still learning Backbone but it is my understanding that it should handle updating
I'm learning Backbone and had some issues with the on()-function. But actually it's a
Learning C at University. This is not a homework, but I was trying to
I'm pretty new to backbone.js and am still learning how everything works. I'm trying
I am learning backbone routes. I just built a small app using backbone. But
I'm learning Backbone.js and got stuck on this simple example. Could you explain what's
This may seem like a really off-the-wall question, but I've been learning how Backbone.js
So, I am learning out backbone.js and are currently iterating over some models in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.