JS:
$(function(){
$(\"#example\").popover({
placement: \'bottom\',
html: \'true\',
title : \'
Previous examples have two main drawbacks:
Below is a solution which has not such drawbacks.
By the default, the 'popover' element is inserted immediately after the referenced-element in the DOM (then notice the referenced-element and the popover are immediate sibling elements). Thus, when the 'close' button is clicked, you can simply look for its closest 'div.popover' parent, and then look for the immediately preceding sibling element of such parent.
Just add the following code in the 'onclick' handler of the 'close button:
$(this).closest('div.popover').popover('hide');
Example:
var genericCloseBtnHtml = '';
$loginForm.popover({
placement: 'auto left',
trigger: 'manual',
html: true,
title: 'Alert' + genericCloseBtnHtml,
content: 'invalid email and/or password'
});