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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:25:08+00:00 2026-05-25T13:25:08+00:00

App.Views.VideoView = Backbone.View.extend({ initialize: function() { _.bindAll(this, ‘render’); this.model = this.options.model; this.render(); }, render:

  • 0
App.Views.VideoView = Backbone.View.extend({
    initialize: function() {
        _.bindAll(this, 'render');
        this.model = this.options.model;
        this.render();
    },
    render: function() {
        JST.video({
            model: this.model
        });
        return this;
    }
});

App.Views.PlayListView = Backbone.View.extend({
    el: $("#playlistWrapper"),
    initialize: function(videos) {
        _.bindAll(this, 'render');
        this.modelViews = $.map(videos.models, function(model, i) {
            return new App.Views.VideoView({
                model: model
            });
        })
        this.render();

    },
    render: function() {
        var that = this;
        $(this.el).clear();
        $.each(this.modelViews, function(i, modelView) {
            $(that).el.append(modelView.render().el);
        });

        return this;
    }
});

i am always getting below error

$(this.el).clear is not a function
[Break On This Error] $(this.el).clear(); 

it seems my el of PlayerListView is empty.

i have div with id playlistWrapper.

if i use jquery selector for playlistWrapper it gives proper element.

what am i doing wrong.

  • 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-25T13:25:08+00:00Added an answer on May 25, 2026 at 1:25 pm

    I’m a little late to the party on this, but the problem is that you’re specifying a jquery selector before the DOM is loaded.

    A backbone object is defined with an object literal passed in to the extend method. For example, the following are functionally the same:

    MyView = Backbone.View.extend({
      el: "#foo"
    });
    
    var viewObj = {el: "#foo"};
    MyView2 = Backbone.View.extend(viewObj);
    

    values on the right-hand side of a key/value pair in an object literal are parsed and executed immediately. this means that a jQuery selector used for el will be parsed as soon as you declare it, not when the view is instantiated. chances are, you have your javascript file included in your app and it’s being downloaded before the DOM is loaded, so the jquery selector can’t find the element you’re referring to.

    There are a number of things you can do to work around this.

    • you can call $(this.el) whenever you need to use the element
    • you can set this.el in the view initializer
    • you can set {el: $("#whatever")} as a parameter to the view constructor, assuming the view is constructed after the DOM has loaded
    • you can use the javascript module pattern to defer definition of the views and other backbone objects until after the DOM is loaded
    • and probably a handful of other options that i’m not thinking of at the moment
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this code in my app\views\pages\home.html.erb file <%= render :template => 'users/new' %>
My app/views/layouts folder looks like this: application.html.erb user_sessions.html.erb errors.html.erb These work fine and i
I keep getting this error compile error /Users/dean/src/carolian/app/views/layouts/events.html.erb:10: syntax error, unexpected ',', expecting ')'
How can I make the code indent correctly? app/views/layouts/shared.html.haml: = render :partial => shared/head
In this rails app: https://github.com/ryanb/govsgo/blob/master/app/views/authentications/index.html.erb There is a form that as 'new_user_path' Where is
I have the following form in my /app/views/password_resets/new.html.erb view <% form_tag password_resets_path do %>
For a winforms app, what do you think the ideal directory structure for views
When I run my app with Leaks and view the Extended Details for any
I'm writing an iOS app with a table view inside a tab view. In
How would one change the view on the screen programmatically in an iPhone app?

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.