如何在我的popover内容中添加换行符?换行标记,也不是新行字符都可以正常工作.这是我正在尝试的:
- $(".foo").hover(function () {
- $(this).popover({
- title: "Bar",content: "Line 1 <br /> Line 2 \n Line 3"
- }).popover('show');
- },function () {
- $(this).popover('hide');
- });
解决方法
您需要在初始化popover时传递html:true选项.然后< br />和其他html标签应该工作:
- $(".foo").hover(function () {
- $(this).popover({
- title: "Bar",content: "Line 1 <br /> Line 2 <br /> Line 3",html: true
- }).popover('show');
- },function () {
- $(this).popover('hide');
- });
https://groups.google.com/forum/?fromgroups=#!topic/twitter-bootstrap/bhtpERLYCo4