Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break text to multiple lines in bootstrap popover content

I am trying to add text content of bootstrap popover with multiple lines. I am creating string with possible line break as below, I have tried \n, \r\n, <br>, <br/> and <br /> but all vain.

     var files = 'No files selected';
        if (path.length > 1) {
            files = '';
            for (var i = 0; i < path.length - 1; i++) {
                files += path[i] + '<br />';
            }
        }
     $(this).attr('data-content', files);
     $(this).popover('toggle');

from above code what input do I get in popover is shown below

enter image description here

I have read in some posts to add / update popover contents through content tag but didn't work. Plus there was a post to set HTML content for the popover which I didn't get. I don't know what to do to create new lines by using above method or similar one.

like image 284
Saqib Avatar asked Sep 09 '14 07:09

Saqib


1 Answers

You could either add data-html="true" or do that in JS. For the JS solution please refer to How do you add line break to JQuery popover .

like image 160
Anticom Avatar answered Oct 16 '22 21:10

Anticom