So while digging around in our group's past discussions centered
around the Validate plugin (which is awesome by the way), I found a
function that deals with the placement of the error message on an
invalid input.  This was great because I needed to append the error to
the invalid input's parent li, rather than placing the error
immediately after the input.  I tinkered a bit further and also added
the class "invalid" to the parent li as well.

My issue is this: how do I remove the "invalid" class from the parent
li when its input is edited and subsequently validates?  I'd prefer to
have the plugin's script handle this, rather than writing some
additional function.  Below is a snippet of the script I'm working
with, and a bit of a starting point for the success function (though
it is totally wrong, and possibly way off).  Any help would be greatly
appreciated!


$("#signup").validate({
    //better error placement to keep from breaking the grid on
checkboxes
    errorPlacement: function(error, element) {
       error.appendTo( element.parents('li').addClass('invalid') );
    },

    //THIS IS THE PART I'M HAVING TROUBLE WITH
    //kill the invalid class on success
    success: function(element){
        element.parents('li').removeClass('invalid') );
    }

   //rules and messages arbitrary to my issue go here
});

Reply via email to