简体   繁体   中英

Tooltip Title attribute does not work

When I add this code, tooltip does not appear on SVG Elements (Circle, rect)

I am using this code because I wanto to use <p> and <span> tag within the tooltip

Code;

$(function () {
      $.widget("ui.tooltip", $.ui.tooltip, {
          options: {
              content: function () {
                  return $(this).prop('title');
              }
          }
      });

      $(document).tooltip();
  });

It works except svg When I remove this, it works for svg elements but not <p> <span> tags

Thanks in advance.

I'm using jquery-ui

As @Robert Longson declared in the comment

I assign a title attribute to both elements and children, then it works.

It was like;

$( "#elementId" )[ 0 ].title = '<span class="red-span"> TRY OUT </span>';
$( "#elementId" )[ 0 ].children.title = '<span class="red-span"> TRY OUT </span>';

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