jQuery 如何使用引导工具提示?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16461317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:11:32  来源:igfitidea点击:

How to use bootstrap tooltip?

jquerytwitter-bootstraptooltip

提问by M.R

I have used Bootstrap but the tooltip is not working

我使用过 Bootstrap 但工具提示不起作用

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

Or do I need to use jQuery?

还是我需要使用 jQuery?

回答by Gautam3164

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

我的最终FIDDLE终于HERE

回答by Freelancer

use jqueryselectorsas follows:

使用jqueryselectors如下:

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

Hope Its Helpful.

希望它有帮助。