Bruce Gust
asked on
Why am I being told that "indexOf" is not a function?
Here's my code:
Everything works except...
if(usrEEID.indexOf("S")==- 1)
{
$('#usrEEID').css('border' , 'solid 2px red').focus();
error = "Make sure you include a capital \"S\" in the Employee ID field!";
}
I keep getting an error that says "usrEEID.indexOf is not a function." What am I doing wrong?
function validateForm() {
var dob = document.getElementById("usrDOB");
var usrEEID = document.getElementById("usrEEID");
var error = '';
if(usrEEID.indexOf("S")==-1)
{
$('#usrEEID').css('border', 'solid 2px red').focus();
error = "Make sure you include a capital \"S\" in the Employee ID field!";
}
if (!isValidDate(dob.value))
{
$('#usrDOB').css('border', 'solid 2px red').focus();
error = "Date of Birth must be in the format XX/XX/XXXX\n\r";
}
else
{
$('#usrDOB').css('border', '');
}
if (error.length > 0) {
alert(error);
return false;
}
return true;
}
Everything works except...
if(usrEEID.indexOf("S")==-
{
$('#usrEEID').css('border'
error = "Make sure you include a capital \"S\" in the Employee ID field!";
}
I keep getting an error that says "usrEEID.indexOf is not a function." What am I doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Pawan weighed in and I want to honor his time...
ASKER
Thanks, friend!
ASKER
I just deleted this question not realizing you had responded. I'll give the points just as a way to say, "Thank you" for your time.
I was able to figure it out. What I was lacking was this: var usrEEID = document.getElementById("u
The ".value" is what made all the difference.
Thanks for your help, though!