Preventing an input from losing focus?

Preventing an input from losing focus?

Basically I want to prevent a user from moving to another field if the current one is invalid (non-numeric).

I've tried a few things that I though would do the job, I've also tried using the change event with the last line (resetting the focus to the current element) but no dice.

Can anyone give me a hand?
  1. jQuery('.setupprice, .monthlyprice, .quantity','#config_dialog').live('focusout',function(e)
        {
          var val = parseFloat(jQuery(this).val());
          if(isNaN(val))
          {
            jQuery(this).css('background-color','red').css('color','white');
          // My attempts to do this so far





  2.       e.stopPropagation();
  3.       e.stopImmediatePropagation();
          e.preventDefault();
          return false;
          jQuery(this).focus();
          }
          else
          {
            jQuery(this).val(val.toFixed(2)).css('background-color','').css('color','');
          }
        });