Hi,
I have a text box and want to put validation on it.My code is like :
<asp:TextBox ID="txtName" runat="server" onKeyDown="limitText(this,25);" onKeyUp="limitText(this,25);" MaxLength="25"></asp:TextBox>
function limitText(limitField, limitNum) {
if (limitField.value.length > limitNum) {
alert("my message");
limitField.value = limitField.value.substring(0, limitNum);
}
}
Here if I am using MaxLength attribute of textbox , then onKeyDown and onKeyUp are not working. I am not getting any alert.Removing MaxLength atrribute all working fine.
Any suggestion.
Thanks in advance