I have a relatively simple set of inputs that need correct validation, and I seem to have a hiccup so far. Upon clicking send, only the empty fields should be filled in with the .errorVal class to give them a red background. So that is the visual side of the validation. Also, I need these fields to have character validation. So, First and Last name cannot contain numbers. Email needs to have an @ symbol at some point. Any ideas?
http://jsbin.com/OlUGiXE/1/edit?html,css,js,output
$('.sendSupport').click(function () {
if ($("table.forceCenter > input[type=text]:empty").length == 0 && $("textarea:empty").length == 0) {
//alert('sent')
$('.sentVal').fadeIn();
$('.emptyVal').hide();
// clear values
$("input[type=text], textarea").val('').removeClass('errorVal');
} else {
//alert('empty')
$('.emptyVal, .errorStar').fadeIn();
$('.sentVal').hide();
$("input[type=text]:empty, textarea:empty").addClass('errorVal');
}
});