knockout.js Text


Example

The text binding can be used with any element to update it's innerText.

<p>
  <span data-bind="text: greeting"></span>,
  <span data-bind="text: subject"></span>.
</p>
ko.applyBindings({
  greeting: ko.observable("Hello"),
  subject: ko.observable("world")
});

The text binding may also be used with virtual elements.

<p>
  <!--ko text: greeting--><!--/ko-->, 
  <!--ko text: subject--><!--/ko-->.
</p>