[thelist] Javascript array loop issues?

Tris beertastic at gmail.com
Thu Oct 29 12:05:43 CDT 2009

Hi all..
Major Javascript woes today...
I'm learning.. well, relearning Ajax.. I've a from that IU wanna
display dynaimic errors..
Anyhoo, I've prepared an array of my errors in an array (inputId : message)
I want to loop through that array, and then IF there's a message
value, then echo it...
For this example, i'm just echoing some alerts.. but I'm not getting any...

What ROOKIE mistake am I making today? ;-p
Peace and love...


<script type="text/javascript">

   var getErrors = new Array();
   var getErrors = {"lookingWhat":"Who are you looking for?",
                           "genderWhat":"What gender are you?",
                           "emailInvalid":"Invalid Email Address",
                           "FieldsEmpty":"Pleace complete all fields"};

   for (i=0;i<getErrors.length;i++) {
       for(getErrors in value) {
           var getKey = $('#'+getErrors[i]);
           var getVal = value[i];
           if (getVal.val() == '') {
               alert('is an error');
           } else {
               alert('no error');


More information about the thelist mailing list