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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:41:03+00:00 2026-06-04T05:41:03+00:00

I have started to create a web application with backbone.js and have run into

  • 0

I have started to create a web application with backbone.js and have run into a bit of a problem. It is allowing me to create new items, no problem at all. However, it is not binding the events to buttons created on the render() method. Basically, each time I add a new item, I get an Edit and Delete button, and I would like to bind the model to them so I can retrospectively Edit or Delete that specific item.

My backbone view:

ClientView = Backbone.View.extend({
    el: $("body"),
    initialize: function () {
        this.clients = new Clients(null, { view: this });
    },
    events: {
        "click #add-client": "AddClient",
        "click .edit-client": "EditClient",
        "click #save-client": "SaveNewClient"
    },
    render: function (model) {
        var compiled_template = _.template($("#Client-Template").html());
        $("#client-rows").append(compiled_template(model.toJSON()));
        $("input:button", $("#client-rows")).button();
        $("#addClientModal").modal("hide");
        return this;
    },
    AddClient: function (model) {
        $("#addClientModal h3").text("Add Client");
        $("#addClientModal").modal("show");
    },
    EditClient: function (model) {
        $("#addClientModal h3").text("Edit Client");
        $("#addClientModal").modal("show");
    },
    SaveNewClient: function () {
        var client_firstName = $("#clientFirstName").val();
        var client_lastName = $("#clientLastName").val();
        var client_email = $("#clientEmail").val();
        var client_address = $("#clientAddress").val();
        var client_model = new Client({ FirstName: client_firstName, LastName: client_lastName, Email: client_email, Address: client_address });
        this.clients.add(client_model);
        $("#clientFirstName, #clientLastName, #clientEmail, #clientAddress").val("");
        $("#addClientModal").modal("hide");
    }
});

My template:

<script id="Client-Template" type="text/template">
<tr>
    <td><%=FirstName%></td>
    <td><%=LastName%></td>
    <td><%=Address%></td>
    <td>
        <input type="button" class="btn btn-info .edit-client" value="Edit" />
        <input type="button" class="btn btn-danger" value="Delete" />
    </td>
</tr>
</script>

Unfortunately I cannot pastebin the entire application, but with any luck it should be relatively simple to notice where I am going wrong with what I have provided. Obviously if you need more details from me please do ask.

  • 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-06-04T05:41:05+00:00Added an answer on June 4, 2026 at 5:41 am

    You have an erroneous dot (.) in your class attribute on your button

    .edit-client
    

    should be

    edit-client
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going to create a new web application that is very customized. It
Normally I create web application projects and use code-behind, but I have a requirement
thanks in advance for the replies.... I have started to create a network topology
I have created the following database layout, and started coding the application. The more
I have created a small chatting application in C#, and started as a Console
At my work we have an existing ASP.NET web application and are duplicating some
Question for Python 2.6 I would like to create an simple web application which
I am getting started with iPhone application development and would like to create an
I started working on a web application. This application needs lot of image handling.
We have developed a mildly sophisticated web application using JQueryUI and themes. We chose

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.