How to get a jquery error div to fade out when all errors are cleared -
i've got code i've been using show form errors @ top of form change. code fades in error box when errors have been cleared snaps shut. prefer either have fade away or slide transition isn't jarring can't figure out how accomplish , appreciate helping hand. below code i'm using create error block. in advance.
errorelement: "div", errorplacement: function(error, element) { offset = element.offset(); error.addclass('message'); // add class wrapper error.css('position', 'absolute'); error.css('left', offset.left + element.outerwidth()); error.hide().insertbefore(element) }, onfocusin: function( element, event ) { this.lastactive = element; // hide error label , remove error class on focus if enabled if ( this.settings.focuscleanup && !this.blockfocuscleanup ) { if ( this.settings.unhighlight ) { this.settings.unhighlight.call( this, element, this.settings.errorclass, this.settings.validclass ); } this.addwrapper(this.errorsfor(element)).fadeout(); } }, showerrors: function() { var i, elements; ( = 0; this.errorlist[i]; i++ ) { var error = this.errorlist[i]; if ( this.settings.highlight ) { this.settings.highlight.call( this, error.element, this.settings.errorclass, this.settings.validclass ); } this.showlabel( error.element, error.message ); } if ( this.errorlist.length ) { this.toshow = this.toshow.add( this.containers ); } if ( this.settings.success ) { ( = 0; this.successlist[i]; i++ ) { this.showlabel( this.successlist[i] ); } } if ( this.settings.unhighlight ) { ( = 0, elements = this.validelements(); elements[i]; i++ ) { this.settings.unhighlight.call( this, elements[i], this.settings.errorclass, this.settings.validclass ); } } this.tohide = this.tohide.not( this.toshow ); this.hideerrors(); this.addwrapper( this.toshow ).fadein(); }, highlight: function(element) { $(element).prev('label').addclass("error"); $(element).addclass("error"); }, unhighlight: function(element) { $(element).prev('label').removeclass("error"); $(element).addclass("valid"); }, errorcontainer: $('#errorcontainer'), errorlabelcontainer: $('#errorcontainer ul'), wrapper: 'li',
Comments
Post a Comment