I have a very simple questionnaire form that only needs a few fields be mandatory. How can I add an email validation to the email field to confirm its an actual email. and how can I confirm that the zip_code contains only numbers? Also would be awesome if instead of using an alert I could use a div tag that would show up on the form and tell them what they need to fill out if anyone knows how to simply add that. I am using Twitter Bootstrap and would love to use their warning div's
$(document).ready(function(){
$('#contact_form').submit(function(){
if ($('#first_name').val() == '') {
alert('You must enter your first name!');
return false;
}
if ($('#last_name').val() == '') {
alert('You must enter your last name!');
return false;
}
if ($('#email').val() == '') {
alert('You must enter an email!');
return false;
}
if ($('#zip_code').val() == '') {
alert('You must enter your zip code!');
return false;
}
if ($('#message').val() == '') {
alert('You need to tell us something! Please enter your message!');
return false;
}
});
});