Search code examples
javascripttwitter-bootstrappopover

$("a[rel=popover]").popover is not a function


I call the js files for bootstrap twitter library but I get the error that indicates

$("a[rel=popover]").popover is not a function

.

<script src="../../jq/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="../../bootstrap/js/bootstrap-tooltip.js" type="text/javascript"></script>
<script src="../../bootstrap/js/bootstrap-popover.js" type="text/javascript"></script>

<script type="text/javascript">
    $(document).ready(function () {

        // second supervisor popover
        $('a[rel=popover]').popover({
            placement: 'below',
            offset: 20,
            trigger: 'manual'
        });
    });


</script>

Solution

  • This works:

    http://jsfiddle.net/9W53Q/7/

    Edit: http://jsfiddle.net/9W53Q/272/

    Make sure the resoures are being added in the right order (tooltip first). Or like Richard Dalton suggested (and I recommend), just use the compiled bootstrap.js file.

    $(document).ready(function() {
        $('a[rel=popover]').popover();
    });