My focus() doesn't seem to be working....

My focus() doesn't seem to be working....

I have a <input type="text".....OnChange="fixdateformat" id="birthdate">
 
   function fixdateformat() {
      var dait,month, day, year;
      dait=Strtrimchar($("#birthdate").val(),"/");
      var daitlen=dait.length;
      if (daitlen != 8) {
          alert("Invalid Format: Must be MM/DD/YYYY or MMDDYYYY. Example: 01/01/2012 or 01012012. Please Re-enter.");
          document.getElementById("birthdate").focus();   or   .$("#birthdate").focus();
      } else {
         month=dait.substring(0,2);
         day=dait.substring(2,4);
         year=dait.substring(4,8);
        dait=month+"/"+day+"/"+year;
        $("#birthdate").val(dait);
      }
   return;
   }














 
If an invalid format is entered ( !8  in length) it should display the message, then return focus back
to the input element.
 
I get the alert message - but focus doesn't get set to the input field, rather the next element on the form?
 
Any reasons?    I'm currently on IE9 and using JQ 1.7.2, but that shouldn't really matter, I also tried
   using native javascript, and that failed too. I don't get it?!?
 
Thanks
GG