Asp 文本框字符计数器 .on() 事件在 IE 中不起作用

Asp Textbox Char Counter .on() event doesn't work in IE

我的ASP代码:

<asp:TextBox   TextMode="MultiLine" ID="TB_Comments"  runat="server" Height="79px" Width="379px" MaxLength="600"></asp:TextBox>
<span id="chars_comments">600</span> characters remaining 

Jquery代码:

$("document").ready(function () {
$("#<%=TB_Comments.ClientID%>").on("keyup", function () {
    var length = $("#<%=TB_Comments.ClientID%>").val().length;
    var lenght2 = 600 - length; //Current Max Length is 600
    $("#chars_comments").text(lenght2);

});
 });

它在 Chrome 和 Firefox 中完美运行,但在 IE 中不运行。

首先,您必须进行以下更正: $("#chars_comments").text(lenght2); 改为 $("#chars_comments").text(length);

进行此更正后,它在所有浏览器中对我来说都运行良好,即使在 IE (IE 9) 中也是如此。 如果在进行更正后它仍然不适合您,请让我知道 IE 版本。
JQuery 我使用的版本是:1.10.2