posted 11/17/2009 by Sumit Arora
In this blog we will see how we can validate the minimum length of textbox.
<html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Validate Textbox</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> </head> <body > <form id="form1" runat="server"> <asp:TextBox ID="txtValidate" runat="server" TextMode="MultiLine"></asp:TextBox> <span id="txtBox_warning" style="color:red"></span > </form> </body> <script type="text/javascript" language="javascript"> $(document).ready(function() { var txtValue = $('#<%= txtValidate.ClientID %>'); $(txtValue).blur(function() { $("#txtBox_warning").empty(); if (txtValue.val().length < 10) $("#txtBox_warning").append("Minimum 10 Characters are required"); }); }); </script> </html>
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18