如何在JQuery popover中添加换行符

前端之家收集整理的这篇文章主要介绍了如何在JQuery popover中添加换行符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在我的popover内容添加换行符?换行标记,也不是新行字符都可以正常工作.这是我正在尝试的:
  1. $(".foo").hover(function () {
  2. $(this).popover({
  3. title: "Bar",content: "Line 1 <br /> Line 2 \n Line 3"
  4.  
  5. }).popover('show');
  6. },function () {
  7. $(this).popover('hide');
  8. });

解决方法

您需要在初始化popover时传递html:true选项.然后< br />和其他html标签应该工作:
  1. $(".foo").hover(function () {
  2. $(this).popover({
  3. title: "Bar",content: "Line 1 <br /> Line 2 <br /> Line 3",html: true
  4. }).popover('show');
  5. },function () {
  6. $(this).popover('hide');
  7. });

https://groups.google.com/forum/?fromgroups=#!topic/twitter-bootstrap/bhtpERLYCo4

猜你在找的jQuery相关文章