you can easily do this using the class and having more and more organized codes:
$(document).ready(function(){ $('.btn').popover(); $('.btn').on('click', function (e) { $('.btn').not(this).popover('hide'); }); });
check out my demo
and if you want to have form control inside, configure this code:
var mycontent = '<div class="btn-group"> <button class="btn">Left</button> <button class="btn">Middle</button> <button class="btn">Right</button> </div>' $('.btn').popover({ content:mycontent, trigger: 'manual' }).click(function(e) { $(this).popover('toggle'); e.stopPropagation(); }); $('.btn').on('click', function (e) { $('.btn').not(this).popover('hide'); }); });
check out the demo
Persianman
source share