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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:42:06+00:00 2026-05-27T21:42:06+00:00

As part of preparation for an Interview I have been asked to read up

  • 0

As part of preparation for an Interview I have been asked to read up on my MVC skills along with JavaScript which I believe will include Backbone and Spine Frame Works.

I have read a lot of websites but all sorts of different ways have been done and yet I cant fathom a simple example. So far I have the following…

A simple ‘cshtml’ file with a div and a button…

<div id="AuthorSection">
    <button id="sayhello">Add Author</button>
</div>

and an Author JS file which alerts me when it has rendered, but not when the event has been fired…

(function ($) {
Authors = Backbone.View.extend({

    el: $('#AuthorSection'),
    events: { 'click #AddAuthor': 'AddNewAuthor'
    },

    initialize: function () {
        _.bindAll(this, 'render', 'AddNewAuthor');
        this.render();
    },

    render: function () {
    },

    AddNewAuthor: function (e) {
        alert('Adding Author');
    }
});

var Authors = new Authors;

})(jQuery);

Any help would be appreciated for someone very new to this type of work….

Thanks

  • 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-27T21:42:07+00:00Added an answer on May 27, 2026 at 9:42 pm

    If your code is executed after the DOM is loaded, it should work as this Fiddle demonstrates http://jsfiddle.net/VcHn8/

    On the other hand, if you execute your code before the DOM is loaded, $(‘#AuthorSection’) is unknown at the time. Remove the el declaration in your view and replace

    var Authors = new Authors;
    

    by

    $(function(){
        new Authors( {el: $('#AuthorSection')} );
    });
    

    See http://jsfiddle.net/C5HXH/1/

    And you should name your variables something different than the name of your constructor

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

Sidebar

Related Questions

I will be part of the development of device driver for android. In preparation,
Part of a new product I have been assigned to work on involves server-side
Part of my table design is to include a IsDeleted BIT column that is
Part of our core product is a website CMS which makes use of various
Part of a real estate application I'm writing will allow a user to subscribe
Part 1: Let's say I do something which throws an exception like: function do_something($somepar)
Part of an app I'm working on involves a messaging interface which I'm trying
Part of our java application needs to run javascript that is written by non-developers.
This the situation: I have one webservice without SSL, which provides two pages for
Part of the GUI I'm building using tkinter has a pop-up window that says

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.