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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:35:03+00:00 2026-05-26T04:35:03+00:00

I am using Backbone in a project and I am trying to get the

  • 0

I am using Backbone in a project and I am trying to get the events functionality of Backbone Views to work correctly. I have the following code (it is extracted out of my current application):

My Base File:

window.App =
   Models: {}
   Views: {}

My Model:

class App.Models.Story extends Backbone.Model
  defaults:
    id: null
    content: null

My View:

class App.Views.Story extends Backbone.View
  tagName: "li"
  className : "story item"

  events:
    "click" : "test"

  test: ->
    alert "TEST"

  render: ->
    html = "<div> #{@model.get("content")} </div>"
    $(@el).html(html)
    return this

The Code on page load:

$(document).ready ->
  story = new App.Models.Story(content: "Some content")
  view = new App.Views.Story(model: story)
  $("body").append(view.render().el)

The element renders but when I click on it, the click handler does not execute. 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-26T04:35:03+00:00Added an answer on May 26, 2026 at 4:35 am

    You are going to hate this answer… you need to declare events not event:

    events:
        "click" : "test"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Backbone.js and sometimes the views events do not get bound correctly. I
Trying to get my head around backbone.js. This example is using Backbone Boilerplate and
We've just started using Backbone and I'm trying to get a handle on a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I'm using backbone with the backbone-rails gem which does its own templating and project
I'm using backbone's underscore templating engine with the mustache formatting patterns. I have already
I have a rails-backbone project that generates jst.ejs templates. I'd like to include some
If I have done my homework correctly, I have come to learn that Backbone
Using the following as an example: var Case = Backbone.Model.extend({ initialize: function(){ this.bind(error, function(model,
I'm using backbone.js for a rails project I've got on the side. I'm embedding

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.