JQuery method not firing?

JQuery method not firing?

Hello all:

In my JQuery method on a Modal dialog form, the first thing I am trying to do is check to see if required fields are filled out before an AJAX call is made:


    if ($('#FirstName').val() !== "") {
      $("#FirstNameHelp").text("");
    }
    else {
      theError = 1;
      alert('First Name Blank');
      $("#FirstName").text("Please enter your first name.");
      return;
    }
   if ($('#LastName').val() !== "") {
      $("#LastNameHelp").text("");
    }
    else {
      $("#LastNameHelp").text("Please enter your last name.");
      return;
    }

When I test this, I get the alert, but then the form just closes, it never gets to the "Last name" test. I have stepped through in the debugger in both Chrome and Firefox, but cannot see any error, and the console shows no errors as well.

Can anyone suggest how I can track this error down? I event tried stripping out all the code on the page except for this method, and no joy.

Thanks in advance for any and all suggestions.

John.