ShadowIT
asked on
"Or" Function with JavaScript
Hello Experts,
I am managing a tool someone else developed and it's using JavaScript for form validation and I need to modify it to allow either 8 or 9 character lengths. As you can see the code below is for 8 and I know that two pipe symbols mean "or" in JavaScript but I've been giving this a go for several hours now with no success so I thought it might be easier to just ask for some help as I am no JavaScript expert myself.
Thanks
I am managing a tool someone else developed and it's using JavaScript for form validation and I need to modify it to allow either 8 or 9 character lengths. As you can see the code below is for 8 and I know that two pipe symbols mean "or" in JavaScript but I've been giving this a go for several hours now with no success so I thought it might be easier to just ask for some help as I am no JavaScript expert myself.
Thanks
function ValidatePurchaseRequisitionNumber() {
if (isNaN(NWF$("#"+jsvPurchaseRequisitionNumber).val()) == true || NWF$("#"+jsvPurchaseRequisitionNumber).val().length != 8 ) {
alert("Purchase Requisition Number must be an 8 character number.");
return false;
}
return true;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER