I am using the popover plugin from Bootstrap. (link) but it's not working.

HTML:

<a data-placement='above' class='danger' rel='popover' data-content='test code here' href='#'>Click</a>

Javascript:

<script type='text/javascript' src="../js/jquery.js"></script>
    <script type='text/javascript' src="../js/twipsy.js"></script>
<script type='text/javascript' src="../js/popover.js"></script>
有帮助吗?

解决方案

The best way is add the following script code:

<script>
    $(function () {
        $("a[rel=popover]")
            .popover({
                offset: 10
            })
            .click(function (e) {
                e.preventDefault()
            })
    })
</script> 

This way, all the a elements with the attribute rel="popover" will get this popover to appear.

No more changes are needed to your code and it works great... at least on my machine, of course ;-)
Try it out!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top