I want to provide feedback to a user when they enter something into a textbox. A little tick if their input matches a RegEx and false if it does not.
What event do I need to use for this? Key up?
For example:
if (inputText.match(/regex/))
{
document.write(input is correct); // or something else
}
I want to provide them feedback as they type. Something like what Yahoo Registration does.
I’d use “keypress”, which is what’s generated after a keyboard activity changes the input value. Thus, “keydown” or “keyup” would tell you that they pressed the backspace key, but “keypress” is what you get after the result of the backspace key.