如何向 JQuery 弹出窗口添加换行符

2024-01-11

如何在弹出窗口内容中添加换行符?换行符标记和换行符都不起作用。这就是我正在尝试的:

$(".foo").hover(function () {
    $(this).popover({
        title: "Bar",
        content: "Line 1 <br /> Line 2 \n Line 3"

    }).popover('show');
}, function () {
    $(this).popover('hide');
});

您需要传递该选项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 https://groups.google.com/forum/?fromgroups=#!topic/twitter-bootstrap/bhtpERLYCo4

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何向 JQuery 弹出窗口添加换行符 的相关文章

随机推荐