Bootstrap tooltips & popovers, and the selector option

This JS Bin demonstrates the use of the selector option passed to the Bootstrap tooltip and popover JavaScript plugins.

The selector option essentially allows you to run tooltips and popovers using jQuery's on function, which means that you can allow dynamically added HTML with the correct selectors to trigger popups as if they were present in the originally loaded DOM. Without the selector option, only elements present in the initial DOM will trigger tooltips; any that are dynamically added will not.

Toggle the checkbox below and click the 'add new popover' button to observe the behavioral differences between using the selector option, and not using it.


$('body').popover({
  selector: '.has-popover'
});
$('.has-popover').popover();