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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:51:01+00:00 2026-05-23T13:51:01+00:00

I am having a problem with dynamically loaded views not being able to attach

  • 0

I am having a problem with dynamically loaded views not being able to attach to the this.el scope variable.

To illustrate what I am trying to achieve:

HTML PAGE

<html>
    <head> head stuff </head>
    <body>
          <div id="appWrap"></div>
    </body>
</html>

Now if I had a view called View.PageSetUp that will add a couple of set up divs to #appWrap I get:

HTML PAGE – View.AppSetUp

<html>
    <head> head stuff </head>
    <body>
          <div id="appWrap">
                <div id="nav">buttons…</div>
                <div id="side">side stuff…</div>
                <div id="content"></div>
          </div>
    </body>
</html>

My problems come when I want to add a specific view to the content stage because this.el will not see the dynamically loaded $('#content').

Trying to then reload the this.el in the initialize function turned out to be a BIG no no… it didn’t like it.

this.el = $('#content'); // rubbish idea!

It feels like dynamically loaded templates and views must be viable in a javascript application, so how would I make this work?

I guess one possibility is that when I am loading my scripts the el is set up then and there:

App.Views.Channel = Backbone.View.extend({
      ………………
})

Should I be using a loader to make this work? If so, any recommendations? I have experience with required but would it be too much for something so simple?

Thanks for your help!

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

    I’ve worked out the solution to this, so I’ll leave it here incase anyone else has the same problem.

    Basically I was setting el in the view itself:

    App.Views.Channel = Backbone.View.extend({
      el : $('#myID'),
      ………………
    })
    

    Where I should have set it when I called a new instance of the view.

    newView = App.Views.Channel(model, { el: $("#search_container") });
    

    All seems to work anyway!

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

Sidebar

Related Questions

i'm having a problem with dynamically loaded forms - instead of using the action
I'm having a problem with the ID property of dynamically loaded UserControls changing during
Having a problem trying to create a function, as part of a BizTalk helper
We were having a problem with our build server not checking out modifications from
I am having a weird issue in ASP.NET MVC with objects not being updated
I'm having a problem with some jquery animations. I have dynamically created divs with
We're having problem with a huge number of legacy stored procedures at work. Do
I'm having problem in the following line: rd.PrintOptions.PaperSize = PaperSize.PaperFanfoldStdGerman; it throws an exception
Having a problem getting a TreeView control to display node images. The code below
Im having a problem with a final part of my assignment. We get in

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.