$(document).ready(function() { // When an invalid input was submitted, the server // adds the "is-invalid" class to form fields to display // them in red with an error message // When starting to type again, we want to remove the error // message to not confuse the user $('input[type="text"]').keyup(function(event) { $(this).removeClass("is-invalid"); }); });