if (success) { $('#'+form).resetForm();//jquery.form.js feature $('#'+form).hide("fast"); //hide the form if you want $('#'+msgdiv).css('display','block'); //display the success $('#'+msgdiv).append(success); // div and message }