I'm writing something that loops through a form to check if any fields are empty. I got to this:
[code=javascript]
function checkEmptyField s()
{
names = new Array("first_na me", "last_name" , "country", "city", "dob_d");
for (i = 0; i < names.length; i++)
{
el = document.almost done.names[i].value;
if(el.empty())
{
alert(el + " was empty");
}
}
}
[/code]
But i keep being told
almostdone is the name of the form.
Not quite sure ¬_¬
[code=javascript]
function checkEmptyField s()
{
names = new Array("first_na me", "last_name" , "country", "city", "dob_d");
for (i = 0; i < names.length; i++)
{
el = document.almost done.names[i].value;
if(el.empty())
{
alert(el + " was empty");
}
}
}
[/code]
But i keep being told
Code:
document.almostdone.names has no properties http://localhost/blog.mahcuz.com/signup/almostdone/js/validateSignUp.js Line 6 line 6: el = document.almostdone.names[0].value;
Not quite sure ¬_¬
Comment