qTip2(工具提示)换行不起作用

我试图在插件qTip2的文本中添加一些换行符,但没有任何成功。

到目前为止,我已尝试过,

以及white-space: pre-line没有任何成功。

您可以查看完整示例http://jsfiddle.net/6asMt/1/

我一直在搜索谷歌,但找不到任何有用的东西。 我希望我的最终结果是:

 Date Start: 2014-04-08 10:00:00 Date End: 2014-04-10-10-00-00 

并不是

 Date Start: 2014-04-08 10:00:00 Date End: 2014-04-10-10-00-00 

请检查这个JS小提琴代码

JS代码:

 $('a').each(function () { if ($(this).hasClass('qTip')) { var value = $(this).next('div:hidden').text(); var title = $(this).attr('title'); $('.qTip').qtip({ style: { classes: 'qtip-bootstrap' }, content: { title: title, //text: value // The problem is here (on the `text` option) text: $(this).next('div')[0].innerHTML } }); } }); 

如果您有任何其他问题,请在下面添加评论。

问候D.

只需在用于获取工具提示值的代码中使用html()而不是text()

FIDDLE DEMO

对于其他想要qtip换​​行符的人,您也可以使用:

 

在你的文字中。 例如,您设置要显示的字符串,如下所示

 $temp = "date begin: 1/8/2018
date end: 2/8/2019";

其余的仍然是一样的。 qtip将识别它并为它创建一个新的线。