Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
108
rated 0 times [  109] [ 1]  / answers: 1 / hits: 21914  / 11 Years ago, tue, december 31, 2013, 12:00:00

I am new to Bootsrap and I am just getting to know it. I am trying to use the tooltip javascript utility, I have done everything how it's supposed to be done according to the webpage, the source code I saw and some answers I found here, but it doesn't work.



Here's where I intend to use it in the HTML:



<!-- Hola mundo -->
<div class=row>
<div class=starter-template tab-content>
<div class=tab-pane fade in active tooltip-demo id=home>
<h1>¡Hola, mundo!</h1>
<p class=lead>Nunc sit amet nunc dui. <a href=# data-toggle=tooltip data-original-title=Pista 1>Aliquam</a> nec viverra mi, et pellentesque sem. In dapibus sem ut consectetur dignissim. </p>
</div>
<!-- /div#home -->
</div>
<!-- /div.starter-template -->
</div>
<!-- /div.row -->


Since the utility needs to be loaded manually, this is what I did:



<script>
$(document).ready(function (){
$('.tooltip-demo').tooltip({
selector: [data-toggle=tooltip],
container: body
})
});


This script is loaded at the footer of the page, after jQuery being loaded.


More From » jquery

 Answers
29

In Bootstrap 3 you can do this a lot easier and you don't need to initaite the $(document) part.



Change the html to



<a href=# data-toggle=tooltip title=pista 1> Aliquam</a>


And the in the script



$('[data-toggle=tooltip]').tooltip({'placement': 'bottom'});


Note: You can change the placement and there are various options all here in the docs


[#73465] Monday, December 30, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anyssaarielles

Total Points: 415
Total Questions: 107
Total Answers: 92

Location: Greenland
Member since Fri, Jul 31, 2020
4 Years ago
;