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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:37:12+00:00 2026-06-17T16:37:12+00:00

I have an observable binding to a textarea within a hidden div like so:

  • 0

I have an observable binding to a textarea within a hidden div like so:

<span title="sales comment" data-bind="attr: { id: 'sales-'+year() }" style="cursor :pointer;">
 <img src="information.png" alt="Add comment" />                                                  
</span>
<div data-bind="attr: { id: 'sales-'+year()+'_content'  }" style="display : none;">
 <textarea data-bind="value: salesComment, valueUpdate: 'keydown'"> </textarea>
</div>

and viewModel

var FinancialYearViewModel = function(data, parent) {
    var self = this;
    self.year = ko.observable();
    self.salesComment = ko.observable();
};  

ko.applyBindings(new FinancialHistoryViewModel(data));

var data = {"year": "2012", "salesComment": "sales comment"}

The hidden div is used to populate the content of a qtip tooltip like this:

$(document).ready(function()
{
$("span[title]").each(function(i) {         
    content = $("#" + this.id + "_content").html();
    $(this).qtip({  content: {
          text: content
         },                     
             show: {
              event: 'click'
             },
             hide: { event : 'unfocus'}                         
    });                      
  });
});

The viewModel binds ok and qtip displays the hidden div as its content as required. However when the textarea value changes the viewModel does not update.

It does work when I remove the inline css from the div, i.e:

<div data-bind="attr: { id: 'sales-'+year()+'_content'  }">
 <textarea data-bind="value: salesComment, valueUpdate: 'keydown'"> </textarea>
</div>

But I need to hide the contents of the div by default as it’s used only when a user views a qtip.

Any ideas why this css is preventing the observable from updating the 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-17T16:37:13+00:00Added an answer on June 17, 2026 at 4:37 pm

    I think the issue is that you’re passing in the innerHTML content of the corresponding div as the qtip content, which effectively means you’re duplicating HTML and loosing all viewmodel bindings.

    Here’s the problem line:

    content = $("#" + this.id + "_content").html();
    

    For this to work, the content of the qtip needs to be exactly the same element nodes as the nodes you’ve bound the viewmodel to.

    I haven’t looked into the content options qtip accepts, but have you tried:

    content = $("#" + this.id + "_content")[0];
    

    [UPDATE] – I’ve found this thread where the author comments on this. So it looks like you won’t be able to use the same element nodes for the content of the qtip for version 1, but you can do this for qtip version 2.

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

Sidebar

Related Questions

I have an observable collection of objects that I'd like to display on the
I have one observable collection with user control. And I am bind it in
The situation is like this: I have an Observable Collection that has a bunch
I have a Knockout observable array that I wish to edit from within Javascript
I have a WPF ListView , where I bind an observable collection, and below
I have an observable array binding to a dropdownlist. The dropdownlist is populated on
I have an observableArray of records which I bind using a template binding. This
Lets say I have name = ko.observable('John') that is bind to the input as
I have the following very simple code: html <a data-bind=enable: selected() href=http://www.google.com>Click Me</a> javascript
I have an observable array with var items= [ {image: /images/image1.jpg }, {image: /images/image2.jpg

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.