<commit_before>var valid;
$('#registration-form').find(':input').each(function() {
  $(this).on({
    blur:function(){ // Add an onblur event handler to each field to trigger a validation

      valid = validate_input($(this).val(), $(this).attr('type'));

      if(valid) {
        $(this).parent().removeClass('has-error');
      } else {
        $(this).parent().addClass('has-error');
      }

    },
    keydown:function(){ // Add an onkeyup event handler to each field to clear its error state

      $(this).parent().removeClass('has-error');

    }
  });
});
<commit_msg>keydown -> keyup<commit_after>var valid;
$('#registration-form').find(':input').each(function() {
  $(this).on({
    blur: function(){ // Add an onblur event handler to each field to trigger a validation

      valid = validate_input($(this).val(), $(this).attr('type'));

      if(valid) {
        $(this).parent().removeClass('has-error');
      } else {
        $(this).parent().addClass('has-error');
      }

    },
    keyup: function(){ // Add an onkeyup event handler to each field to clear its error state

      $(this).parent().removeClass('has-error');

    }
  });
});

{'fraction_non_alphanumeric': 0.19638242894056848, 'fraction_numerical': 0.0, 'mean_word_length': 3.0347222222222223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '801872', 'n_tokens_mistral': 345, 'n_tokens_neox': 336, 'n_words': 81}