JS:
$(function(){
$("#example").popover({
placement: 'bottom',
html: 'true',
title : '<span class="text-info"><strong>title</strong></span> <button type="button" id="close" class="close">×</button>',
content : 'test'
})
$('html').click(function() {
$('#close').popover('hide');
});
});
HTML:
<button type="button" id="example" class="btn btn-primary" ></button>
i'm write your code isn't show your popup.
anyone come across this problem?
For anyone who is still a little confused:
Here is how it works to toggle the popover after you have gotten it to show, select the same button you used to trigger it and call .popover('toggle') on it.
In this case, for closing the popover the code would be:
$('#example').popover('toggle');
I needed to find something that would work for multiple popovers and in Bootstrap 3.
Here's what I did:
I had multiple elements I wanted to have a popover work for, so I didn't want to use ids.
The markup could be:
The content for the save and close buttons inside the popover:
and the javascript for all 3 buttons:
This method works when the container is the default not attached to body.
When the container is attached to 'body'
Then, use the aria-describedby to find the popup and hide it.
Here's a "cheat" solution:
Follow the usual directions for a dismissable popup.
Then slap an 'X' in the box with CSS.
CSS:
JQUERY:
HTML:
Technically speaking that makes it dismissable if someone clicks something other than the "X" but that's not a problem in my scenario at least.
Sticky on hover, HTML:
Javascript:
I have struggle with this one and this is the simplest way to do it, 3 lines of js: