Code:<asp:TextBox ID="TextBox1" runat="server" onKeyPress='return maxLength(this,"30");'></asp:TextBox>When I Press any Character , maxLength function is not called,WHy SO?Code:function maxLength(field,maxChars) { alert('onKeyPress'); if(field.value.length >= maxChars) { event.returnValue=false; alert("more than " +maxChars + " chars"); return false; } }




Reply With Quote