I'm working with the validation plugin and I'm trying to work out the id of the first form field that causes an error. Hopefully someone will tell me there's a really easy way to do this but I couldn't find it so, as a start, I've added a new function in validate.js:
returnList: function() { console.error( this.errorList ); }, I've added this just after the countErrors function. In my form page I've added: var errorFound = $('#theform').submit(function(){if (validator.countErrors() > 0){ validator.returnList() }}); With the above I see in the console an object returned that says: Object useremail=Please enter a valid email address And, if I click on the above I get the full object: recipientemail please enter a valid address useremail please enter a valid address What I'd like to be able to do in returnList is (pseudo code)... returnList: function() { return( this.errorList[id[0]] ); }, ...to return 'recipientemail' (or 'useremail', I'm not fussed). Can anyone tell me what I need to put in the [brackets] to retrieve what I want? I've tried id, element, name, key, etc but I'm not getting anywhere so perhaps I'm going about this the wrong way? Thanks _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/