Java Script not working in Content page using ASP.NET C# and I am trying to count the character of multi-line text box below is character count code. Getting Below error.
Failed to load resource: the server responded with a status of 404 (Not Found) Uncaught ReferenceError: txtComments is not defined(…)
Below is my code JS and Design code.
<script type="text/javascript">
function characterCounter(controlId, countControlId, maxCharlimit) {
if (controlId.value.length > maxCharlimit)
controlId.value = controlId.value.substring(0, maxCharlimit);
else countControlId.value = maxCharlimit - controlId.value.length;
}
</script>
<fieldset style="width: 280px;">
<legend>Counting Remaining Characters example</legend>
<asp:TextBox ID="txtComments" Width="280px" Rows="4" Columns="12" runat="server"
TextMode="MultiLine" onkeyup="characterCounter(txtComments, this.form.remCount, 150);"
onkeydown="characterCounter(txtComments, this.form.remCount, 150);" /><input type="text"
name="remCount" size="3" maxlength="3" value="150" readonly="readonly" />
characters left
</fieldset>
When I am trying to type some thing values is not changing.