3

The target is accessible by passing the argument e to the anonymous function for content.

gridToolTipz = $('#grid').kendoTooltip({ 
    filter: "td[role=gridcell]",
    content: function (e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    },
    show: function(e) {
            var target = e.target; // the element for which the tooltip is shown
            ...
    }
});

Is it possible to achieve the same thing on show? The above code doesn't work.

jtromans
  • 4,183
  • 6
  • 35
  • 33

1 Answers1

5

You can always access the target element by calling tooltip.target():

var toolTip = $('#grid').kendoTooltip({
    filter: "td[role=gridcell]",
    content: function (e) {
        var target = e.target; // the element for which the tooltip is currently shown
        return "Content is: " + target.text(); // use current element for content
    },
    show: function (e) {
        var target = this.target(); // the element for which the tooltip is currently  shown

        if (target) {           
            console.log("now showing with content: ");
            console.log(target.text());
        }
    }
}).data("kendoTooltip");

See demo: http://jsfiddle.net/lhoeppner/mcpxj/

Lars Höppner
  • 18,252
  • 2
  • 45
  • 73