Search code examples
jquerytwitter-bootstrap-3popover

Show popover without trigger


I want to show a popover without any trigger option.. I tried this but it isn't working..

$('#boo').popover({
    placement : 'right',
    html : true,
    trigger : 'show', 
    content: "write sth"
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="boo" type="submit" class="btn btn-default">go</button>

[update] I just noticed that show isn't listed in trigger options.. (link).. is there a way to get it work?


Solution

  • You can just call the show method

    $('#boo').popover({
        placement : 'right',
        html : true,
        trigger : 'show', 
        content: "write sth"
    });
    
    $('#boo').popover('show')
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/js/bootstrap.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css" rel="stylesheet"/>
    <button id="boo" type="submit" class="btn btn-default">go</button>