Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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');
});
like image 805
Boundless Avatar asked Jan 01 '13 19:01

Boundless


People also ask

How do you break a line in data content?

The <br> HTML element produces a line break in text (carriage-return).

How do I add a new line in tooltip?

Just use the entity code &#013; for a linebreak in a title attribute.

How do you add BR to a title?

You can use &#013; or &#010; .

How do I show popover in jquery?

$(document). on('click','#bulk_actions_btn',function(){ if(condition){ $('[data-toggle="popover"]'). popover(); //here if the condition is true then popover should be display. }


1 Answers

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

like image 112
antinome Avatar answered Oct 21 '22 14:10

antinome