jquery dispara h5Validate para mostrar un mensaje de error

How can I trigger h5Validate and display the ("#error-email") when the class"ui-state-error"

I need to display the errors when the the h5Validate adds the class.

mi por ejemplo: http://jsfiddle.net/hsSru/30/

gracias

preguntado el 09 de marzo de 12 a las 16:03

Esto duplica stackoverflow.com/questions/9636608/… See my answer there. -

Looks like you asked the same question twice, just one hour between them. -

1 Respuestas

You can override addClass to trigger an event :

(function(){
    // Your base, I'm in it!
    var originalAddClassMethod = jQuery.fn.addClass;

    jQuery.fn.addClass = function(){
        // Execute the original method.
        var result = originalAddClassMethod.apply( this, arguments );

        this.trigger('classChanged');

        // return the original result
        return result;
    }
})();

And then you can do your stuff :

$("#error-email").bind('classChanged', data, function(){
    if(this.hasClass("ui-state-error")){
        //do your stuff
    }
});

respondido 09 mar '12, 16:03

thansk pal, could you put it into a fiddle plz? - DD77

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.