I have several buttons, and for each of them I need to add a popover.
I want it like this:
when my user clicks on one of them, I want the others to be hidden. so only one popover is displayed
check and help me fix this plz example:
var mycontent='<div class="btn-group"> <button class="btn">Left</button> <button class="btn">Middle</button> <button class="btn">Right</button> </div>'
$('.btn').popover({ html: true, content:mycontent, trigger: 'manual' }).click(function(e) { $(this).popover('toggle'); e.stopPropagation(); }); $('html').click(function(e) { $('.btn').popover('hide'); });
my html:
<ul> <li> <a href="#" class="btn" data-toggle="popover" data-placement="bottom" title="" >Popover</a> </li> <li> <a href="#" class="btn" data-toggle="popover" data-placement="bottom" title="" >Popover</a> </li> </ul>
jsfiddle example
adding something like the code below, I decided to somehow solve the problem:
$('.btn').click(function(e) { $('.btn').popover('hide'); });
but double-clicking on each button will not be so.
twitter bootstrap
PersianMan Apr 22 '13 at 14:53 2013-04-22 14:53
source share