I have a textbox and a submit button.
I want to validate a textbox whether it is empty or not using javascript and not validator controls like RequiredFeildValidator in asp.net. i.e i want to do client side validation.
Please guide me how to do it using javascript,any tutorials will be great help.
Here are my asp controls
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
You can have the onClick run a javascript function to check the length of the value in the text box. A link on how to set up the onclick, if you have any questions…
http://www.w3schools.com/js/js_events.asp
Also, remember that it is best practice to have scripts in the
<head>tag.