Click here to Skip to main content
16,016,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have an html textbox:
<input type="text" name="UserName"/>

How can i give validation to this textbox. I need the textbox using Html code not using @html.Editor for.


Please help
Posted

You can have a client side validation using javascript. You should refer to this page.

Client Side Validation using JavaScript[^]
 
Share this answer
 
Another trick that I just learn is if you are using HTML 5, you can simply add "required" attribute to your input tag i.e;

<input type="text" name="UserName" required/>

It will ask for a value when you submit this textbox.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900