My text input field in a web form has a JavaScript function declared like this:
<asp:TextBox ID="TextBox1" runat="server" onKeyUp="javascript:Count(this);" TextMode="Number"></asp:TextBox>
function Count(text) {
// Handling textarea maxlength in ASP.NET manually
var maxlength = 4;
var object = document.getElementById(text.id);
if (object.value.length > maxlength) {
object.focus();
object.value = text.value.substring(0, maxlength);
object.scrollTop = object.scrollHeight;
return false;
}
return true;
}
I have also set the TextMode property of the TextBox to Number, but I am able to enter the letter "e" or "E" despite this, and the JavaScript function is not triggered when I do so. How can I correct this issue?