var form = $(this).parents('form'), params = [ $(form).find('[name="REGISTER[NAME]"]'), $(form).find('[name="REGISTER[PERSONAL_PHONE]"]') ], i = params.length, error = false; while (i--) { if ($(params[i]).val() == '') { error = true; $(params[i]).addClass('error'); } else { $(params[i]).removeClass('error'); } } console.log(error); if (error) { return false; }
99 views