简体   繁体   English

在jQuery工具提示中使文本变为粗体?

[英]Making text bold in jQuery tooltip?

I am using jQuery tooltip in angular controller. 我在角度控制器中使用jQuery工具提示。 I need to show some tooltip content in Bold style. 我需要以粗体显示一些工具提示内容。

I have tried the following content function, It's giving some error. 我已经尝试了以下内容功能,但出现了一些错误。

jQuery( function() {
            jQuery( document ).tooltip({
                tooltipClass: "custToolTip",
                style: {
                  height: 300,
                  overflow: 'auto'
                },
                position: {
                    my: "left-50 bottom-15",
                    at: "bottom right",
                    collision: 'none'
                }
                content: function() {
                  return jQuery(this).prop('title');
                }                    

            });
        });

After adding that content element,It's giving some error. 添加该内容元素后,它给出了一些错误。 Is something am I doing wrong? 我做错什么了吗?

What is the error that it's giving? 它给的错误是什么?

After a quick first look there seems to be a comma missing between position and content . 快速浏览后, positioncontent之间似乎缺少逗号。

Try: 尝试:

jQuery( function() {
            jQuery( document ).tooltip({
                tooltipClass: "custToolTip",
                style: {
                  height: 300,
                  overflow: 'auto'
                },
                position: {
                    my: "left-50 bottom-15",
                    at: "bottom right",
                    collision: 'none'
                },


      content:{ 
         function() {
                      return jQuery(this).attr('title');
                    }  
      }    });

I think this line has some issue return jQuery(this).prop('title'); 我认为这行有问题return jQuery(this).prop('title'); . Just change it to return jQuery(this).attr('title'); 只需更改它以return jQuery(this).attr('title'); . May work. 可能会工作。 I am referring this site. 我指的是这个网站。 check this . 检查一下。 It may help. 这可能会有所帮助。 https://jqueryui.com/tooltip/#custom-content https://jqueryui.com/tooltip/#custom-content

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM