I have created the following text-box and label:
<asp:TextBox ID="MyTextBox" runat="server"/>
<asp:Label ID="MyLabel" runat="server"/>
Moreover, I have created the following JavaScript function:
function characterLimit(myTextBox, myLabel)
{
myLabel.innerHTML = myTextBox.value.length + '/' + myTextBox.maxLength;
}
Finally, in the code-behind, I have performed the following:
TextBox1.Attributes.Add("OnKeyUp", "characterLimit(MyTextBox, MyLabel);");
characterLimit() gets called. However, nothing happens; it is as though I am passing MyTextBox and MyLabel incorrectly (above). What is the correct way of doing this?