$(function () {

    $("[data-toggle='popover']").each(function() {
        //get id of this help button
        var divId = $(this).attr("data-helpid");
        //use the id to get the content of the hidden div
        var content = $('#' + divId).html();

        var options = {
            html: true,
            title: divId.replace(/-/g, ' '),
            content: content,
            container: 'body'
        };

        $(this).popover(options);
      
    });
    $("[data-toggle='popover']").on("click", function(e) {
        e.stopPropagation();
    });
    var hideAllPopovers = function() {
        $("[data-toggle='popover']").each(function() {
            $(this).popover('hide');
        });
    };
    $(document).on('click', function(e) {
        hideAllPopovers();

    });
});
