Mobile Content

Saturday, December 24, 2011

Validate Textbox length using Javascript in

Validate length of Texbox upto 10 char


in .aspx page

<script type="javascript">
function count(text,long)
             var maxlength=new Number(long);
             if( text.value.length > maxlength )
                      text.value= text.value.substring(0,maxlength);


<asp:TextBox id="TextBox1" runat="server"  onkeyup="count(this,10)" onchange="count(this,10)" TextMode="multiline"  />


Alert will be shown when character exceed 10 character

No comments:

Post a Comment