Search code examples
javascriptjqueryqtip

Is it possible to tell qTip 2.0 to use other attribute than 'title' as default?


How do i tell qTip to use another attribute than 'title' as default?

The reason i need to use another attribute, is because when i disable qtip and dynamically add elements with "title", the title will show when i hover my mouse over the element. Which i dont want to happen.

Thanks


Solution

  • In our project, we also use qTip and force it to use content of a children instead of Title attribute. The children content is hidden by default (CSS -> display:none;)

    $('.tipped').each(function()
    {
        $elem = $(this);
        $elem .qtip({
            content: $elem.children('.tiptext').html(),
            show: 'mouseover',
            hide: 'mouseout',
            position: {
                corner: {
                    target: 'bottomMiddle',
                    tooltip: 'topMiddle'
                }
            },
            style: {
                tip: true,
                name: 'blue',
                color: '#A04242',
                background: '#EEEEEE',
                border: {
                    width: 1,
                    radius: 3,
                    color: '#4F81BD'
                }
            }
        });
    });