You are pointing to the
button with the submit() function. Buttons don't submit, forms do.
$('form#guestDetail input#next').submit(function() {
You could start with this, but with the previous information, I think you may need to rethink your logic.
$('form#guestDetail input#next').
click(function() {
Before doing that, you can simplify your selectors quite a bit. If you have the id next,
<input type="submit" id="next" value="Next >">
You don't need the form or input selector
$('form#guestDetail
input#next').click(function() {
You can do
$('#guestDetail #next').click(function() {
and probably don't even need the form id selector
$('#next').click(function() {
So this brings us to the question whether click will work as you are operating on the form. I suggest you pass a reference to the form in your function.
$('#next').click(function() { validateForm(this.form); }
//
function validateForm(form) {
msg='';
if ($('#first').value=='') { msg += 'The first name field is required.\n'; }
if ($('#last').value=='') { msg += 'The last name field is required.\n'; }
if ($('#email1').value=='') { msg += 'The email field is required.\n'; }
if (msg=='') { form.submit(); }
else { alert(msg); }
return false;
}
(This approach is further complicated by some users not being able to click - try tab/tab/tab to highlight the button and press enter.) You always want to return false on the click, so the form doesn't submit.
Another (and probably better) way to approach it is use a submit handler on the form, combined with other handlers on your buttons.
<form action="" method="post" onsubmit="validateForm(this);">
Note that when done this way, it's not "this.form" - only use that on form input objects.