Bootstrap popover is not working

前端 未结 3 943
野性不改
野性不改 2021-02-06 22:41

The bootstrap popover is not showing up my page

Here is my HTML:

3条回答
  •  独厮守ぢ
    2021-02-06 23:11

    Although the accepted answer is fine, when dealing with popovers, please be careful of situations with double initialization as well (Fiddle example). The below JavaScript will fail.



    Click Me (Working)

    Click Me (Failing)

    If you double-initialize and your popover uses values that may change or custom content, etc., you will be in a world of hurt:

    $(function () {
        $('#firstButton').popover({
          container: "body",
          html: true,
          content: function () {
            return '
    ' + $(this).data("message") + '
    '; } }); $('#secondButton').popover(); // <-- The first initializer does this, which causes the next one to fail on the next line. $('#secondButton').popover({ container: "body", html: true, content: function () { return '
    ' + $(this).data("message") + '
    '; } }); });

提交回复
热议问题