How to break line in jQueryUI tooltip

后端 未结 4 931
半阙折子戏
半阙折子戏 2021-02-05 03:35

The new version of jQueryUI (1.9) comes with the native tooltip widget. After testing with it, it works fine if the content (value of the title attribute) is short. But if the c

4条回答
  •  情深已故
    2021-02-05 04:11

    This is my trick to do it with latest jquery / jqueryui

    It's assuming all of the items you want to have tooltips have class 'jqtooltip', they have title tags, and the title has a pipe character for a line separator.

    $('.jqtooltip').tooltip({ 
      content: function(callback) { 
         callback($(this).prop('title').replace('|', '
    ')); } });

提交回复
热议问题