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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:52:31+00:00 2026-05-28T04:52:31+00:00

I have an unordered list, and I’m attempting to append a few links to

  • 0

I have an unordered list, and I’m attempting to append a few links to one of the line items.

I’m also trying to wire-up links to each of the line-items, and each of the links I’m placing within the line-items following the lost techies examples.http://lostechies.com/derickbailey/2011/10/11/backbone-js-getting-the-model-for-a-clicked-element/

I’m calling one view to another to another in order to keep the the models connected to the links.

What I can’t figure out is I append this.el with the results of my ItemMatch view, so why would my html end up

<ul>
   <li>
      list-item called this.el
   </li>
   <a href="#">
      first item
   </a>
  <a href="#">
      second item
   </a>
     <a href="#">
      third item
   </a>
</>
MyApp.Views.ItemList = Backbone.View.extend({
    tagname: 'li',
    classname:'item_list',
    ...

    render_item_match: function(model){
            var item_match = new MyApp.Views.ItemMatch({model:model});
        $(this.el).append(item_match.el);
        }


});

MyApp.Views.ItemMatch = Backbone.View.extend({
    tagname: 'a',
    classname: 'item_match_result',

    initialize: function(){
        _.bindAll(this,"item_match_result");
        this.render();
    },


    events : {
        "click a.item_result": "item_match_result"
    },

    render : function(){
        this.el = HandlebarsTemplates['items/itemSearchResultItem'](this.model.attributes);

    },

    item_match_result: function(){
     console.log(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-05-28T04:52:32+00:00Added an answer on May 28, 2026 at 4:52 am

    tagname and classname? Try to use tagName and className

    Something like this works fine:

    MyApp = {Views:{}};
    MyApp.Views.ItemList = Backbone.View.extend({
        tagName: 'li',
        className:'item_list',
        //....
        initialize : function() {
            $('body').append($('<ul></ul>'))
            this.render();
        },
        render: function(){
            $('ul').append($(this.el));
        this.render_item_match();
        },
        render_item_match: function(model){
            var item_match = new MyApp.Views.ItemMatch({model:model});
            $(this.el).append(item_match.el);
        }
    });
    
    MyApp.Views.ItemMatch = Backbone.View.extend({
        tagName: 'a',
        className: 'item_match_result',
        initialize: function(){
            _.bindAll(this,"item_match_result");
            this.render();
        },
        events : {
            "click a.item_result": "item_match_result"
        },
        render : function(){
            this.el = _.template('<a href="#">testLink</a>');
    
        },
        item_match_result: function(){
            console.log(this);
        }
    });
    
    new MyApp.Views.ItemList();
    

    Output:

    <ul><li class="item_list"><a href="#">testLink</a></li></ul>

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

Sidebar

Related Questions

I have an unordered list with five list items, each with a link inside
I have an unordered list with five list items, each with a link inside
I have unordered list of links and i am trying to get the clicked
I have an unordered list, with a couple list-items inside. Inside each of those
I have an unordered list, which has maybe 30 items. When one of these
I have an unordered list of items, I want to display each item as
I have an unordered list of links that I need to append the index
I have an unordered list and each list element contains a photo and a
I have a unordered list <ul id=images > . There are 3 list items
I have an unordered list whose list items are displaying inline. However, its layout

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.