Knockout-jQueryUI

Fork me on GitHub

Tooltip.html

Customizable, themeable tooltips, replacing native tooltips.

Parameters

For each of the widget's options the binding has a corresponding option with the same name. These can be set to static values, or bound either to normal or to observable properties of the viewmodel.

For each of the widget's events the binding has a corresponding option with the same name. These can be set to functions. When invoked the value of the this keyword evaluates to the viewmodel.

widget

Should be bound to one of the viewmodel's writeable observables. The binding will write a jQuery object containing the binding's DOM element into it. The primary use for this option is to invoke the widget's methods on the element.

isOpen [two-way binding]

Opens/closes the tooltip. This is only intended to be set for non-delegated tooltips.

Example

HTML

<p>
  <button id="item" data-bind="tooltip: { content: content, isOpen: isOpen, items: '#item' }">This button has a tooltip.</button>
</p>
<p>
  <label for="content">Tooltip's content:</label><input id="content" type="text" data-bind="value: content, valueUpdate: 'afterkeydown'" />
</p>
<p>
  <label for="isOpen">Is open:</label><input id="isOpen" type="checkbox" data-bind="checked: isOpen" />    
</p>

JavaScript

var ViewModel = function () {
  this.content = ko.observable('test');
  this.isOpen = ko.observable(false);
};

Result