I want my popover to show multiple data-content, ie 3 different lines of text inside the popover. I have the following code, referred from w3schols.
<!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="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h3>Popover Example</h3>
<a href="#" data-toggle="popover" title="Popover Header" data-placement="bottom" data-content="Info 1">Toggle popover</a>
</div>
<script>
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
</script>
</body>
</html>
The popover looks like this.
I want the popover to show three more options like "Info 1", "Info 2" and "Info 3" like a list view. How can I achieve this?
Try:
Demo; http://jsfiddle.net/jo6og612/
1)Define div with html which you want to show in popover
<div class="container">
<h3>Popover Example</h3>
<a href="#" data-toggle="popover" title="Popover Header" data-placement="bottom">Toggle popover</a>
<div id="popover-content">
<ul>
<li> Info 1 </li>
<li> Info 2 </li>
<li> Info 3 </li>
</ul>
</div>
</div>
2) Add content and html properties of popover
<script>
$(document).ready(function(){
$('[data-toggle="popover"]').popover(
html: true,
content: function() {
return $('#popover-content').html();
}
);
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.