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 8372371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:24:51+00:00 2026-06-09T14:24:51+00:00

Is return this necessary at the end of every method within a Backbone view?

  • 0

Is “return this” necessary at the end of every method within a Backbone view?

render: function() {
this.editElem();
// I realize it wouldn't be necessary here, but...
},

renderElem: function() {
this.$el.addClass('foobar');
return this // is this one necessary?
},

EDIT
What about this example?

render: function() {
this.editElem();
},

renderElem: function() {
this.$el.addClass('foobar');
return this;
},
  • 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-09T14:24:52+00:00Added an answer on June 9, 2026 at 2:24 pm

    To quote what the official documentation says

    A good convention is to return this at the end of render to enable chained calls.

    So no it’s not necessary but it’s probably a good idea.

    In general you will see it in methods that modify/render the view’s el, by returning this in one of those methods you are making it easier to access the view’s el, so that you can now do something like

    $("#somelist").append(myview.render().el);
    

    instead of doing it in two lines like

    myview.render();
    $("#somelist").append(myview.el);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea how to properly 'return' this JSON object (in JavaScript): function
This is my object : var obj = { a:{ x:1 y:function(){return this.x //works
I find myself doing this repeatedy. $jq(button).filter(function(){ return this.id.match(/^user_(\d+)_edit$/); }).click(function(){ var matches = this.id.match(/^user_(\d+)_edit$/);
I used a code: jQuery.fn.MyFunction = function(){ return this.each(function() { attributes = test; return
I wrote a function to return a generator containing every unique combination of sub-strings
This code doesn't work: return this.Context.StockTakeFacts.Select(stf => ((stf.StockTakeId == stocktakeid) && (stf.FactKindId == ((int)kind)))).ToList<IStockTakeFact>();
I'm not sure if return *this is the only way we could return an
Class parent { protected void myMethod() { if(someCodition) { //return this as well as
I am using PHP and I return this value: $_SESSION['sessionNum'] and I get an
I need a mutable boolean field in Java (I will return this field via

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.