How to insert close button in popover for bootstrap

前端 未结 25 2927
忘了有多久
忘了有多久 2020-11-29 20:53

JS:

$(function(){
  $(\"#example\").popover({
    placement: \'bottom\',
    html: \'true\',
    title : \'         


        
25条回答
  •  既然无缘
    2020-11-29 21:37

    I was running into the problem of the tooltip doing some funky stuff when the close button became clicked. To work around this I used a span instead of using a button. Also, when the close button was clicked I would have to click the tooltip twice after it closed in order to get it to open again. To work around this I simply used the .click() method, as seen below.

    ×

    $('#myTooltip').tooltip({
        html: true,
        title: "Hello From Tooltip",
        trigger: 'click'
    });    
    
    $("body").on("click", ".tooltip-close", function (e) {
        else {
            $('.tooltip').remove();
            $('#postal-premium-tooltip').click();
        }
    });
    

提交回复
热议问题