Line break inside a Boostrap Popover

Asked

Viewed 2,030 times

2

How to make line breaks inside a bootstrap Popover

Example

  echo"<a href=\"#\" data-toggle='popover' data-title='Popover on Left' data-content='$data <br> $data' data-placement='left'> <span class=\"label label-success\">Print / Send</span></a>";

  //Aqui em    data-content='$data <br> $data'  
  //queria fazer a quebra em linhas mais quando imprimi sai a tag <br> e não quebra

inserir a descrição da imagem aqui

  • Fabio, have you tried n ? Another thing that can work is to save both $datain another variable, for example, $datas = $data."&#xA;".$data; // Space being a New Line

1 answer

5

Use the HTML property

To place HTML content inside the text or title, adjust the property html for true. See the specification of popover

Example:

$(document).ready(function(){
    $('[data-toggle="popover"]').popover({html: true});   
});
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h3>Popover Example</h3>
  <ul class="list-inline">
    <li><a href="#" title="Header" data-toggle="popover" data-placement="right" data-content="Content <br> Content">Right</a></li>
  </ul>
</div>

</body>
</html>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.