Bootstrap Tutorial - Create popover








The following code shows how to create popover.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/css/bootstrap.min.css">
<script type='text/javascript'
  src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.1/bootstrap.min.js"></script>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){<!--from  w  w w.  j  a  v  a2  s .co  m-->
$('body').popover({
    selector: '.has-popover',
    trigger: 'hover'
});
$('.add-one').on('click', function () {
    $('#popover-triggers').append("<a class='btn has-popover' data-content='Hello world'>Added trigger</a>");
});
});//]]>  
</script>
</head>
<body>
  <div id="popover-triggers">
    <a class="btn has-popover" data-content="Hello world">Initial
      trigger</a>
  </div>
  <a class="btn btn-orange add-one">Add new Popover trigger</a>
</body>
</html>

Click to view the demo