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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:28:19+00:00 2026-06-04T07:28:19+00:00

I have the following code in this jsFiddle. The problem I’m having is that

  • 0

I have the following code in this jsFiddle.

The problem I’m having is that my child items do not update properly.

I can Click “Edit User” with a problem and see the data changing, but when I attempt to add a note or even if I were to write an edit note function, the data does not bind properly

http://jsfiddle.net/jkuGU/10/

<ul data-bind="foreach: Users">
<li>
    <span data-bind="text: Name"></span>   
    <div data-bind="foreach: notes">
        <span data-bind="text: text"></span>
        <a href="#" data-bind="click: $parent.editNote">Edit Note</a>
    </div>
    <a href="#" data-bind="click: $parent.addNote">Add Note</a>
     <a href="#" data-bind="click: $parent.EditUser">Edit user</a>
</li>
</ul>

    <div id="userModal" data-bind="with: EditingUser" class="fade hjde modal">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">×</a>
            <h3>
                Editing user</h3>
        </div>
        <div class="modal-body">
            <label>
                Name:</label>
            <input type="text" data-bind="value: Name, valueUpdate: 'afterkeydown'" />
        </div>
        <div class="modal-footer">
             <a href="#" class="btn btn-primary">Save changes</a>
        </div>
    </div>

<div id="addJobNoteModal" data-bind="with: detailedNote" class="fade hjde modal">
        <div class="modal-header">
            <a class="close" data-dismiss="modal">×</a>
            <h3>
                Editing Note</h3>
        </div>
        <div class="modal-body">
            <label>
                Text:</label>
            <input type="text" data-bind="value: text, valueUpdate: 'afterkeydown'" />
        </div>
        <div class="modal-footer">
             <a href="#" class="btn btn-primary" data-dismiss="modal">Save changes</a>
        </div>
    </div>
​



function Note(text) {
    this.text = text;
}

var User = function(name) {
    var self = this;
    self.Name = ko.observable(name);
    this.notes = ko.observableArray([]);
}

var ViewModel = function() {
    var self = this;
    self.Users = ko.observableArray();

    self.EditingUser = ko.observable();
    self.detailedNote = ko.observable();
    self.EditUser = function(user) {
        self.EditingUser(user);
        $("#userModal").modal("show");
    };


    this.addNote = function(user) {
        var note= new Note("original")
        self.detailedNote(note);
        $("#addJobNoteModal").find('.btn-warning').click(function() {
            user.notes.push(note);
            $(this).unbind('click');
        });

        $("#addJobNoteModal").modal("show");
    }

    for (var i = 1; i <= 10; i++) {
        self.Users.push(new User('User ' + i));
    }
}

ko.applyBindings(new ViewModel());​
  • 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-04T07:28:21+00:00Added an answer on June 4, 2026 at 7:28 am

    Change this:

            $("#addJobNoteModal").find('.btn-warning').click(function() {
    

    To this:

            $("#addJobNoteModal").find('.btn-primary').click(function() {
    

    You were targetting the wrong button 🙂

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

Sidebar

Related Questions

I have the following code at http://jsfiddle.net/qPtXL/ As you can see the problem is
I have the following piece of code - jsfiddle example The problem i'm having
I have the code that you can check in this fiddle: http://jsfiddle.net/4SCrp/5/ <form id=my_form>
I have created the following code http://jsfiddle.net/N65yS/41/ .. My problem is this.. When I
I have the following code: Bear in mind that while this code works on
I have the following code to do this, but how can I do it
I have the following code: SPList list = web.Lists[this.ListName]; SPListItem item = list.Items.Add(); now
I have the following code: http://jsfiddle.net/SPWWx/ I'm completely new to javascript, this is my
I have the following javascript code found also in this fiddle: http://jsfiddle.net/periklis/k4u4c/ <button id
In this jsFiddle http://jsfiddle.net/littlesandra88/RBU8K/ have I the following code function addRemove(id) { alert(1); $('#'+id).toggle(function()

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.