We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,555 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Turn off qtip when content is empty

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;


    }   
2
Contributors
1
Reply
12 Hours
Discussion Span
3 Months Ago
Last Updated
13
Views
Question
Answered
code_rum
Junior Poster in Training
73 posts since Feb 2013
Reputation Points: 8
Solved Threads: 12
Skill Endorsements: 4

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

Troy III
Master Poster
779 posts since Jun 2008
Reputation Points: 140
Solved Threads: 100
Skill Endorsements: 5
Question Answered as of 1 Month Ago by Troy III

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0567 seconds using 2.68MB