javascript - JQuery exclude one field from validation -
I created this code to validate the checkout form. But there is an area which is not needed. All other areas are required to exclude this field, how can I modify my code, and if this field is full and is not empty then just add class 'valid'.
Is there any such suggestion for me? Validate the checkout field $ ('#outout-data input'). ECH (function () {$ (this) .change (function () {if ($ (this) .val (). Length & lt; 1) {$ (this) .removeClass ('valid') .addClass ('invalid');} and {$ (this) .removeClass ('invalid') .addClass ('valid ');}});}); Require a In addition,
required
class to input Field
and then change your code,
$ ('#outoutout-data input.required') .each (function () {$ (this) .change (function ( ) ($ (This) .removeClass ('valid'). AddClass ('invalid');} and {$ (this) .removeClass ('invalid') AddClass
$. Not required for each
like,
$ ('#outout-data input .required'). Change (function (if (this.value.length & lt; 1) {$ (this) .removeClass ('valid'). AddClass ('invalid');} and {$ (remove this) RemoveClass ('invalid') .addClass ('valid');}});
Comments
Post a Comment