0

This works (using KnockoutFire & Firebase):

var viewModel = KnockoutFire.observable(
           new Firebase("https://<my-firebase>.firebaseio.com/"),
           { "div_1": true });

       ko.applyBindings(viewModel);





<input type="text" data-bind="value: div_1"/>

This doesn't:

<div data-bind="html: div_1" contenteditable="true"></div>

Anyone know how to observe changes to something other than a textarea?

jthomasbailey
  • 410
  • 1
  • 8
  • 19
  • 1
    IIRC, observing DOM changes is tricky. [Mutation events](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Events/Mutation_events) are broken, badly supported, and deprecated, and [mutation observers](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#Browser_compatibility) are IE11 and above only. – millimoose Sep 07 '13 at 02:43
  • 1
    You're looking for a custom binding on contenteditable, and change events on contenteditable; both have been answered here on SO previously: http://stackoverflow.com/questions/1391278/contenteditable-change-events http://stackoverflow.com/questions/7904522/knockout-content-editable-custom-binding http://stackoverflow.com/questions/16246127/knockout-contenteditable-and-markdown – Kato Sep 16 '13 at 17:02

0 Answers0