Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
Implement .popover("toggle") method in Bootstrap
To toggle the popover on button click, use the popver("toggle") method.
Set the popover toggle as ?
$(document).ready(function(){
$(".btn-default").click(function(){
$("[data-toggle='popover']").popover('toggle');
});
});
On button click, the popover generates ?
<button type="button" class="btn btn-default"> (Course) Toggle Popover </button>
The popver, on button click, generates the popover on a link ?
<a href="#" data-toggle="popover" title="Languages" data-content="C, C++, Java"> Learn </a>
The following is an example stating the usage of popver("toggle") method ?
Example
<!DOCTYPE html>
<html>
<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.3.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">
<a href="#" data-toggle="popover" title="Languages" data-content="C, C++, Java">Learn</a>
<div>
<p>The following is the button:</p>
<button type="button" class="btn btn-default">(Course) Toggle Popover</button>
</div>
</div>
<script>
$(document).ready(function(){
$(".btn-default").click(function(){
$("[data-toggle='popover']").popover('toggle');
});
});
</script>
</body>
</html> Advertisements
