简体   繁体   中英

Making text bold in jQuery tooltip?

I am using jQuery tooltip in angular controller. 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 .

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'); . Just change it to return jQuery(this).attr('title'); . May work. I am referring this site. check this . It may help. https://jqueryui.com/tooltip/#custom-content

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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