Bootstrap Tutorial - Toggle popover








The following code shows how to toggle popover.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.10.1.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0-rc1/css/bootstrap.min.css">
<script type='text/javascript'
  src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0-rc1/js/bootstrap.min.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!--from   w w w . j a v  a 2 s .co  m-->
    $('input[type=text]').focusin(function() {
      $(this).popover('toggle');
    });
    $('input[type=text]').focusout(function() {
      $(this).popover('toggle');
    });
});
</script>
</head>
<body>
  <table cellpadding="5" width="50%">
    <tr>
      <td>Name</td>
      <td><input type="text" id="name" data-content="hejlos"
        name="name" class="form-control" /></td>
    </tr>
    <tr>
      <td>CVR-number</td>
      <td><input type="text" name="cvr" class="form-control"
        data-content="CVR"></td>
    </tr>
  </table>
</body>
</html>

Click to view the demo