Search code examples
jqueryhtmltitlejscriptqtip2

qTip2 - Add a titlebar to my tooltip?


i want to add a title to my qTip2 tooltip. Currently i have this code:

<script>
    $(document).ready(function () {
        $('[title]').qtip({
        style: { classes: 'qtip-dark'}    
    });
});
</script>

<div title="TITLE">TEXT</div>

This gives me a text with a simple tooltip (http://beta.summonersindex.com/test.html). I just do not get managed to add a title, as it is shown on the demo page: http://qtip2.com/demos ('Add a title'). I searched for a solution for this a lot, but they are either out of date or not working for me. I hope you guys can help me! Thanks :)


Solution

  • You can do it like this:

    JS

    $(document).ready(function () {
        $('.someText').qtip({
            style: { classes: 'qtip-dark'},
            content: {
                text: 'Your text here',
                title: 'Your title here'
            }
    
        });
    });
    

    HTML

    <div class="someText">TEXT</div>