Am trying to get a tooltip that has more styling than the plain text that a tool tip normally has.
I see that a Twitter Bootstrap tooltip is black, white text, has an arrow, etc.
My tool tips look like this:
I have read that to fix this I need to add this:
<script>
$(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
I did that and it has no effect.
The only thing I could possibly think might be affecting it is that this is an Aurelia application and I am doing this in a <template>
.
Anything else I can be checking to see why this is not working?
Code:
<template>
<script src="myPathToJQuery/[email protected]/jquery.js"></script>
<script src="myPathToBootstrap/twbs/[email protected]/js/bootstrap.js"></script>
<button type="button" class="btn btn-default" data-toggle="tooltip"
data-placement="top" data-html="true" title="<b>Tooltip</b> <em>on </em> right">
Tooltip on right
</button>
<script>
$(function() { $("[data-toggle='tooltip']").tooltip(); });
</script>
</template>
2
Answers
I got an answer from an Aurelia team member. This is what he said:
Bootstrap's tooltip component requires javascript. Use a custom attribute to execute the tooltip javascript
Then on the element, add the bootstrap-tooltip attribute:
It works against the aurelia skeleton app. (I will work it into my typescript app.)
There is small mistake in your code
You missed D letter from data-placement, your code should be:
Instead of: