I want to check if Zipcode text field has value of 99999 but the way it's written now gives an error.
full code: function validateStep(step){ if(step == fieldsetCount) return;
var error = 1;
var hasError = false;
$('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input.req:not(button)').each(function(){
var $this = $(this);
var valueLength = jQuery.trim($this.val()).length;
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
var zipAllowed = ['pa', "ca"] ;
if(valueLength == "" || $(this).attr('id') =='email' && !emailPattern.test($this.val()) || $(this).attr('id') == 'zipcode' && ($this.val(99999)))
{
hasError = true;
$this.css('background-color','#FFEDEF');
}
else
$this.css('background-color','#fff');
});
The EmailPattern check works fine but I can't seem to assign specific values only for the zipcode?