I’m working on ASP.NET with C#.
I have a TextBox and I want to validate if the user is writing the correct length for the TextBox.
If the user is not entering the correct length I want a message to display on a label. But I want this check to happen on the fly, as the user is writing.
How can I do this?
Thanks.
suppose these are your asp.net elements
your js should be something like:
note that
id$='messageandinput[id$='txtTest']in jQuery means id ends withWhen you mark an element to be run at server, asp.net append some other names at the start of the actual client id based on the name of you page.
and here is working demo