• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

error should clear when typing

I have a validation on my form that when I hit submit all empty fields add a class called 'error-red'

How can I add a line of jquery to the code, that when someone starts typing in an input field with that class, the class should be removed?
0
rivkamak
Asked:
rivkamak
1 Solution
 
GaryCommented:
Depends on your markup - shoud we guess?

$("someinput").focus(function(){
$("someerrorclass").hide()
})

Open in new window

0
 
leakim971PluritechnicianCommented:
test page : http://jsfiddle.net/oxx8t99c/
$("form").on("keyup", ".error-red", function() {
     if( $.trim($(this).val()).length > 0 ) {
          $(this).removeClass("error-red");
     }
});

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now