I've scoured countless forums, including this one, for information on the onkeyup event, and I've tried everything but nothing seems to work:
Here is my JavaScript code:
<script type="text/javascript">
function Count() {
var i = document.getElementById('txtOr').value.length;
document.getElementById('lblRem').innerHTML = 20 - i;
}
</script>
And here is my aspx code:
<asp:TextBox ID="txtOr" runat="server" Font-Size="X-Large" Height="700px" Width="100%" TextMode="MultiLine" OnTextChanged="txtOr_TextChanged" ClientIDMode="Static" onkeyup="Count()"></asp:TextBox>
<asp:Label Text="20" runat="server" ID="lblRem" style="font-size:20px"/>
I've attempted every method I could find online:
In the C# Page_Load method, adding
[didn't work]txtOr.Attributes.Add("onkeyup","Count()")
In the JS code, trying this:
function Count() {var i = document.getElementById("<%=txtOr.ClientID%>").value.length; document.getElementById('lblRem').innerHTML = 20 - i; }
[still didn't work]
Does anyone have a solution?