【发布时间】:2017-04-19 11:48:04
【问题描述】:
我的 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 中无法运行。
【问题讨论】:
-
我可以知道到底是什么不工作吗?你有什么错误吗?事件未触发?还是找不到元素?
-
.on() 不起作用我也尝试将格式更改为: $("#").keyup(function () { 并且仍然有效在 Chrome 和 Firefox 中,但不在 IE 中
标签: jquery asp.net internet-explorer char counter