Reputation: 15089
My JavaScript:
<script>
$(function(){
$('a[rel=tooltip]').tooltip();
});
</script>
And my HTML:
<br><br><br>This is an example of a sentence with a
<a href="#" rel="tooltip" title="This is the tooltip!">tooltip</a>!
This doesn't show the Bootstrap 2.0 tooltip but shows some default one.
Upvotes: 4
Views: 15917
Reputation: 63616
Let's say you've declared your tooltips declared as follows:
<a href="#" rel="tooltip" class="tip" title="Rating:' + rating + '">'+ name +'</a>
In the same file, make sure you include:
<script type="text/javascript">
$('.tip').tooltip();
</script>
Note that you should either refer to this code after the HTML it references, or wrap it in
<script type="text/javascript">
$(document).ready(function() {
$('.tip').tooltip();
});
</script>
Also note that the jQuery selector refers to a class of tooltips and not just the id of one tooltip.
Upvotes: 5
Reputation: 11
Make sure you have all the css styles for the .tooltip class loaded.
Without these the tooltip may be displayed outside the visible part of your browser window.
Upvotes: 0
Reputation: 228
Try adding the code in footer. it worked for me! for some reason it doesn't work in header!
Upvotes: 7