Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone I've a problem showing tooltip on hover table td, An appropriate message appear. Problem is that first time message showing correct but on second time its not exact that i want on same td that I'm hovering it. Please refer below code, problem is in condition that has class is_invalid.


C#
var indicator = {
    messages :{
        valid : "It is a Valid Change",
        invalid : "It is an Invalid Change",
        invalidEmpty : "You can not have an empty Name"
    },
    tooltipMessage : function(){
        var self = this;

        $('table td').on('mouseover',function(e) {
            var div = $(this).find(".valid_message_box");
            if(div){
                if($(this).hasClass("is_valid ")){
                    $(div).html(self.messages.valid).show();
                    return;
                }
                if($(this).hasClass("is_invalid")){
                    var dataCell = $(this).text();
                    dataCell == "" ? $(div).html(self.messages.invalidEmpty).show() : $(div).html(self.messages.invalid).show();
                    return;
                }
            }
            //$(".valid_message_box").css('top', $(this).position().top - 30).css('left', $(this).position().left + $(this).width());
        });
        $('table td').on('mouseout',function(e) {
            $(this).find(".valid_message_box").hide();
        });
    }
}


Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900