Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show HTML formatted content in Tooltip? (UI Calendar)

I'm trying to display content on multiple lines in the tooltip of calendar entry for UI Calendar and it is not working.

Here is the code

$scope.onEventRender = function(event, element, view) {
    if(event.hover_data) {
        $timeout(function(){
            var hdata = event.hover_data.join('<br />');
            element.attr({'tooltip': hdata, 'tooltip-append-to-body': true});
            $compile(element)($scope);
        });
    }
}

Here is how it looks

enter image description here

Please let me know what I'm doing wrong.

like image 933
jagmohan Avatar asked Oct 28 '15 06:10

jagmohan


People also ask

How to display tooltip in HTML?

Whenever a mouse gets hovers on that specific attribute, it will show text or other information known as a tooltip. It can be displayed at right, left, top or bottom at any position of the text. This is as follows: 1. Top Position In this position, a tooltip will be displayed at the top of the element. 2. Right Position

How to set a position to tool tipped text using CSS?

One can set a position to that tool tipped text by using CSS, which helps us to define some style and position to our tooltip. Using a tooltip to our WebPages is helps us do more interaction with the user because it gives short information of included elements. HTML uses a method that defines tooltip by using the link with a title attribute.

What is the difference between tooltip and title in HTML?

The title is considered as a global attribute, so it allows the user to easily add it to the element, which is as simple as adding a class or id to the element. With the help of that, one can add simply anything means paragraph, div block, which is containing whole column and many more things. Basically, a tooltip is shown top of the element.

What is tool tipped text in HTML?

As shown in the above syntax, the text displayed in the title attribute is considered as tool tipped text. So users can click this link to see more information about it. The title is considered as a global attribute, so it allows the user to easily add it to the element, which is as simple as adding a class or id to the element.


2 Answers

There is no tooltip functionality in ui-calendar. You are probably using bootstrap-ui-tooltip. Besides tooltip it also has a property tooltip-html-unsafe (since v0.3.0, released on 1 May 2013), it was renamed lately. You can read about it in some old documenatation

I made a plunker with html content tooltips

like image 186
Grin Avatar answered Nov 26 '22 06:11

Grin


Stuff that worked for me. Might be useful for someone else

var tooltipText = ['Tooltip', 'text', 'to', 'be', 'split'];

$(element).tooltip({html: true, title: tooltipText.join('</br>')});
like image 37
mr_meeseeks Avatar answered Nov 26 '22 06:11

mr_meeseeks