Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Bootstrap Tooltip to a <span> inside a <div>?

I have a span inside a div and I'm trying to add a Bootstrap 3 tooltip to it:

<div style="display:inline-block;margin-right:10px;">
  <h3>
    <span class="label label-default">
      Chickens: <span style="color:#fff;">3</span>
    </span>
  </h3>
</div>

How do I get this to work?

like image 395
Amy Neville Avatar asked Sep 17 '25 11:09

Amy Neville


1 Answers

I think you are asking for something like this: https://jsfiddle.net/g74Ep/471/

<div style="display:inline-block;margin-right:10px;margin-top: 40px;">
  <h3>
    <span class="label label-default" href="#" data-toggle="tooltip" title="3">
      Chickens: 
    </span>
  </h3>
</div>
<script>
  $(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip(); 
  });
</script>
like image 93
Adam Buchanan Smith Avatar answered Sep 20 '25 02:09

Adam Buchanan Smith