I have this piece of code:
$('.numeric-year').keyup(function () {
$(this).toggleClass('field-error', /10|11|12/.test(this.value));
});
What I’d like to do is exclude a given set of numbers(e.g 10, 11, 12) from triggering the .toggleClass() function.
This question is solely to do with RegEx as the rest of the code is working. Sorry I’m terrible at RegEx stuff…learning slowly.
Any help would greatly be appreciated, Thanks
After having a stab at it myself I came up with this solution
based on Justin Poliey’s answer( Regular Expression to exclude set of Keywords ) telling me NOT to negate in the RegEx but in my code.
Hence the
!before the regex/10|11|12/and it worked a charm. Thanks for your effort guys…Much Appreciated