Search code examples
jqueryqtipqtip2

How render text in qtip2..?


I need to pick up before the show each value of

$('a#functionDescription').attr('title')

How do this..?

   $('a#functionDescription').qtip({
        content: { 
            text: false
        },
        style: {
            width: 250,
            tip: 'leftMiddle',
            color: 'white',
            background: '#66CC33',
            name: 'green'
        },
        position: {
            corner: { 
                target: 'topRight',
                tooltip: 'bottomLeft'
            },
            adjust: { x: 0, y: -25 }
        },
        events: {
            render: function(event, api) {
                //what to write here ?
            }
        }
    });

update:

$('a#functionDescription').attr('title') is changed


Solution

  • You need to specify text as a function:

    content: {
        text: function() {
            return $(this).attr('title');
        }
    }
    

    Inside the function this will be the element being hovered. There is no need to use any event.