Question

Tooltip isn't working idk why but it shows up like this

<script type="text/javascript">
    jQuery(function () {
        $("img[rel='tooltip']").tooltip();
    });
    $("[data-toggle=tooltip]").tooltip();
    </script>
<a href="/forgot" data-toggle="tooltip" data-placement="top" title="forgot login?"><span class="glyphicon glyphicon-question-sign"></span></a>

but not as the black bubble thing

Was it helpful?

Solution

Why is your .tooltip() call outside of your jQuery() function? This will mean the .tooltip() call will execute as soon as that line is parsed by your browser, not when the DOM is loaded. Do this instead:

jQuery(function () {
    $("img[rel='tooltip']").tooltip();
    $("[data-toggle='tooltip']").tooltip();
});

Also, make sure this script is placed AFTER both the jQuery and Bootstrap .js files are loaded.

Edit: Or if you're feeling thrifty, combine your jQuery selectors so you only make one .tooltip() call:

jQuery(function () {
    $("img[rel='tooltip'], [data-toggle='tooltip']").tooltip();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top