$('#Rusername, #Remail, #Rpassword, #Rpassword2').each(function() { if ($(this).val() == '') { $(this).parent().effect('shake', {times: 3}, 50).find('.verdiv').addClass('error'); } });