Boundless
Boundless

Reputation: 2464

How do you add line break to JQuery popover

How can I add a line break in my popover content? Neither the line break tag, nor the new line character is working. This is what I'm trying:

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

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

Upvotes: 16

Views: 24621

Answers (1)

antinome
antinome

Reputation: 3458

You need to pass the option html: true when you initialize the popover. Then <br /> and other html tags should work:

$(".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

Upvotes: 54

Related Questions