$(function() { if ($("input#name").val() == "") { $("input#name").focus(); } else if ($("textarea#comments").val() == "") { $("textarea#comments").focus(); } }); $(function() { $('.error').hide(); $(".button").click(function() { // validate and process form here $('.error').hide(); var name = $("input#name").val(); if (name == "") { $("span#name_error").show(); $("input#name").focus(); return false; } var email = $("input#email").val(); if (email == "") { $("span#email_error").show(); $("input#email").focus(); return false; } var comments = $("textarea#comments").val(); if (comments == "") { $("span#comments_error").show(); $("textarea#comments").focus(); return false; } var dataString = 'form=contact&name='+ name + '&email=' + email + '&comments=' + comments; //alert (dataString);return false; $.ajax({ type: "POST", url: "inc/scripts/support_process.php", data: dataString, success: function() { $('#formcontent').fadeOut(400, function() { $('#form').html("
"); $('#message').html("

Support Form Submitted!

") .append("

We will respond to your message as soon as possible. Thank You!

") .hide() .fadeIn(1500, function() { }); }); } }); return false; }); });