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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:24:38+00:00 2026-06-18T08:24:38+00:00

In my backbone function, i have no.of filter methods, so i decided to instead

  • 0

In my backbone function, i have no.of filter methods, so i decided to instead using ‘this.$el.append()’, ‘this.$el.html()’ – but the replacing html() is not working. i thought i would be fine to repalce hole view with new collections.

as well it tried to make the this.$el.empty(), but not works… so how can i clear the existing element from the parent, and append the new generation elements..?

my code :

    renderBoard:function(item){
          var singleView = new taskListPhraseI.oneView({model:item}),
// after this, i need to make parent of the element should be empty...
          board = this.$el.append(singleView.render()),

          newBoard = board.find('.indBoard:last');
          this.positionBoards(newBoard);
        },

how can i achieve 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-18T08:24:39+00:00Added an answer on June 18, 2026 at 8:24 am

    So if you have your view setup as follows

    views = window.views || {};
    
    views.ExampleView = Backbone.View.extend({
    
        initiliaze: function(){
            // do some stuff
        },
    
        render: function(){
    
            $(this.el).html("<YOUR HTML GOES HERE></YOUR HTML GOES HERE>");
    
            // return yourself as simple to chain access to your "el"
            return this;
        }
    
    });
    

    then when your rendering your view and want to remove all other views before hand, it’d go something like

    renderView: function(item)
    {
        var test=new views.ExampleView({
           model:item
        });
    
        // this should replace the elements contents with the views html above
        $(this.el).html(test.render().el);
    }
    

    If you’re still having trouble, maybe ‘this’ has lost context, and no longer refers to your class, i’d debug what the value of that is when you are rendering.

    Hope that helps

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

Sidebar

Related Questions

I am using backbone validate function but it gives this error again Uncaught TypeError:
I am using Backbone's validate function to guarantee Man to have an age property
I have a rails app using backbone, but when I call save, the server
I'm sure this is obvious but I am new to backbone.js and have wasted
I have a Backbone app and we have stuff like this: render: function() {
So I have this simple backbone setup: $(function() { var chooser = Backbone.View.extend({ el:
I have the following situation: var Task = Backbone.Model.extend({ initialize: function() { }, save:
I can successfully do this: App.SomeCollection = Backbone.Collection.extend({ comparator: function( collection ){ return( collection.get(
I am creating a class for an application backbone and I need this function
In my application i added Marionette.sync plugin and override these methods: Backbone.Marionette.TemplateCache.prototype.loadTemplate = function

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.