Вопрос

I'm trying to use jQuery Tooltip to display a different colour tooltip for errors. I can do this fine with static content using the tooltipClass and styling that class appropriately.

$(".error").tooltip(
{   
   tooltipClass: "ttError"
}); 

Any class which already already has the error class attribute will work correctly but when I use the validate plugin to dynamically add the error class the tooltip will not display correctly. I've only just started using jQuery more so this is out of my scope at the moment, any pointers appreciated.

Это было полезно?

Решение

As ninja said in the comment I just placed the above code in the errorPlacement function for the validate plugin:-

errorPlacement: function(error, element) 
    {
        element.attr('title', error.text());
        $(".error").tooltip(
        {   
            position: 
            {
                my: "left+5 center",
                at: "right center"
            },
            tooltipClass: "ttError"
        }); 
    }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top