简体   繁体   中英

how to use 'show' and 'placement' and other attributes in bootstrap 3 popover altogether?

I have some input fields and a link in my html. I want to pop a popover on the link when any of the input fields are clicked. The codes are given below :

$('.name').on('click', function(){
   $('[data-toggle="popover"]').popover('show');    
});

I get the popover, but I need to define placements and other attributes. I tried in the following way, but failed

$('.name').on('click', function(){
    $('[data-toggle="popover"]').popover('show',{
        placement : 'top'
    }); 
});

Any help is appreciated.

You could use the following:

$('.name').on('click', function () {
    $('[data-toggle="popover"]').popover({
        placement : 'top',
        content : 'I am a popover!'
    }).popover('show');
});

Example Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM