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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:14:06+00:00 2026-05-30T22:14:06+00:00

I have a backbone view like so window.InputView = Backbone.View.extend({ tagName:’input’, className:”, attributes:{}, initialize:function(){

  • 0

I have a backbone view like so

 window.InputView = Backbone.View.extend({
        tagName:'input',
        className:'',
        attributes:{},
        initialize:function(){
            this.attributes=this.model.attributes;
            this.el = this.make(this.tagName,this.attributes,'');
        }
    });

The problem I am having is that When I modify the attributes hash of the View it does not reflect on the el,

So I have to do something like this this.el = this.make(this.tagName,this.attributes,'');
for the changes to reflect .

Is this the only way , or is there a better way to do it ? like automate it ?

  • 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-05-30T22:14:08+00:00Added an answer on May 30, 2026 at 10:14 pm

    To automate whatever you’re trying to do when your model changes you need to bind a method to the change event of the model. In your initialize method you’d need something like:

    initialize: function() {
        this.model.on("change", updateElement);
        ...
    }
    

    and then define that method later on in your view:

    updateElement: function() {
        //use this.model.attributes to update your el
    }
    

    Now, anytime the model associated to that view changes the updateElement method will run.

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

Sidebar

Related Questions

I have this structure of views: window.templateLoaderView = Backbone.View.extend({}); window.PopupView = templateLoaderView.extend({ initialize: function
I have a view and collection like this: window.DmnView = Backbone.View.extend({ template: _.template($(#tmpl_dmnListItem).html()), events:
I have html content like: <button class=submit>Save</button> and view like: var MyView = Backbone.View.extend({
I have a backbone view - which when called presents a form $('#add-offer').click(function() {
TL;DR Is PinView.prototype = _.extend(PinView.prototype, google.maps.OverlayView.prototype) the proper way to have a Backbone View
I have a backbone app with a view structure that looks like the following
I have a backbone view that calls to a sub-view: lr.MapView = Backbone.View.extend({ el:
I have this: var SomeNamespace = { Model: Backbone.Model.extend(), View: Backbone.View.extend({ model: new this.Model,
I have a simple demo app like this Friend = Backbone.Model.extend name:null Friends =
In one of my backbone.js view classes, I have something like: ... events: {

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.