1,105,427 Community Members

Turn off qtip when content is empty

Member Avatar
code_rum
Junior Poster in Training
80 posts since Feb 2013
Reputation Points: 8 [?]
Q&As Helped to Solve: 13 [?]
Skill Endorsements: 6 [?]
 
0
 

Hi,
I am working on a tooltip which shows the content in tooltip if present.
But the code I am using shows the empty tooltip even the content returned is empty.
I don't want to show tooltip or qtip when the content is empty.. :(
Here's my code

HTML
echo "<td class='tr' bgcolor='#ffffff' align='center' width='25'><a id='$i $month $year' class='buttonbar' target='_blank' \"><font $class>$i</font></a></td>";

Jquey
$(document).ready(function () {
$('.buttonbar').each(function() {

        $(this).qtip(
        {
            content: {

                title: tooltip_ajax($(this).attr('id'))


                //title: 'Store ' + $(this).attr('id') // Use the ALT attribute of the area map
        },

        style: {
                width: 200,
                padding: 5,
                background: '#ffffff',
                color: 'black',
                textAlign: 'left',
                border: {
                    width: 7,
                    radius: 5,
                    color: '#ffffff'
                },
                tip: {
                    corner: 'topLeft', // We declare our corner within the object using the corner sub-option
                    color: '#ffffff',
                    size: {
                        x: 20, // Be careful that the x and y values refer to coordinates on screen, not height or width.
                        y : 18 // Depending on which corner your tooltip is at, x and y could mean either height or width!
                    }
                }
            },

            hide: {
                fixed: true,
                delay: 100
            }
    }); 
    });

});
//}

        function tooltip_ajax(date) {
        result = ""; 
        var str = date.split(' ');

        $.ajax ({
            type: "POST",
            url: "popup.php",
            data: {day: str[0], month: str[1], year: str[2]},
            async: false,
            success: function(data) {
            if (data != 0) {
            result = data;
            }
        }
    });
        return result;


    }   
Member Avatar
Troy III
Practically a Posting Shark
891 posts since Jun 2008
Reputation Points: 174 [?]
Q&As Helped to Solve: 119 [?]
Skill Endorsements: 10 [?]
 
0
 

You are misusing IDs for something they were never meant too - don't do that!

Question Answered as of 11 Months Ago by Troy III
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: