> function validate(formData, jqForm, options) { > var x = jqForm[0]; > var valid = x.required.value.split(","); // This works. > for(var i=0; i < valid.length; i++) { // This works. > var z = valid[i]; // This works. > if (!x.z.value) { alert('no'); } // This fails. > } > return false; // Remove when done testing. > }
Do this instead: if (!x[z].value) { alert('no'); }