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

  • Home
  • SEARCH
  • 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 8968253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:25:41+00:00 2026-06-15T17:25:41+00:00

I took a small code from backbone home site, and consoled the function, in

  • 0

I took a small code from backbone home site, and consoled the function, in this example, sidebar.on(‘change:color’), takes the function. but it requires two parameter, one is abiously we need that is ‘color’, and we defining the element inside the function, still why we giving another parameter as ‘model’ here, what that parameter does?

if i remove that parameter send only the color, the function doesn’t work at all… any one help me to understand this?

sample function here:

var Sidebar = Backbone.Model.extend({
    promptColor : function(){
    var cssColor = prompt('Please enter a css color');
        this.set({color:cssColor});       
    }
});

window.sidebar = new Sidebar;

sidebar.on('change:color',function(model,color){ // what model parameter do here?
    console.log(model);
    $('#sidebar').css({
        background:color
    })
})

sidebar.set({color:'green'});
sidebar.promptColor();

when i console the model i got this:

d
_callbacks: Object
_changing: false
_escapedAttributes: Object
_pending: Object
_previousAttributes: Object
_silent: Object
attributes: Object
changed: Object
cid: "c1"
__proto__: x
  • 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-15T17:25:43+00:00Added an answer on June 15, 2026 at 5:25 pm

    It is possible that you want to know which model was affected.

    Consider a case where you are listening to an event on a collection instead. Which model’s color value was modified? The model parameter tells you this.

    Also, consider a case where the same handler is listening to “change:color” on multiple models. Again, you might want to know which model sent the event.

    Just like in other event-driven environments, the “sender” is always passed along with the event data. model, in this case, is the sender.

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

Sidebar

Related Questions

I took the example code from the Kendo UI demos at http://demos.kendoui.com/web/grid/remote-data.html , binding
I put this code in my home.phtml, but nothing is shown. I took this
The following example is taken from: http://php.net/manual/en/function.curl-multi-close.php#example-3540 This example will create two cURL handles,
I took this piece from an unencrypted .DAT file: Code: 00 e1 27 17
i have implement a small code of reading from a file with scanner and
Hi I took the following code from a program I'm writing to check a
I took the rendered page from the SWT Browser and exported it to an
I took over an old HTML based site with all hard coded links, no
I took a look at this answer and it goes in part to solving
I took some code here: Check if role consists of particular user in DB?

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.