How to use bootstrap tooltip? [closed]

2019-02-21 09:40发布

问题:

I have used Bootstrap but the tooltip is not working

<a href="#" data-original-tittle="test" 
            data-placement="right"
            rel="tooltip"
            target=" _blank"> hover me 
</a>

Or do I need to use jQuery?

回答1:

Try to add tooltip like

<script type="text/javascript">
    $(function(){
       $('[rel="tooltip"]').tooltip();
    });
</script>

or you can directly select as

$('a').tooltip();

or try with it

<a href="#" data-toggle="tooltip"
data-original-title="Tooltip on right">hover me</a>

and your script like

$(function() {
    $('a').tooltip({placement: 'right'});
});

MY ULTIMATE FIDDLE finally HERE



回答2:

use jqueryselectors as follows:

<script type="text/javascript">
    $(function () {
        $("[rel='tooltip']").tooltip();
    });
</script>

Hope Its Helpful.