jQuery – 更改输入文本

我正在尝试创建一个函数,当文本输入字段的值更改时,该函数将执行。单击表格单元格时,该字段的值会发生更改,而不是键入,也不会粘贴。我试过这样:
$("#kat").change(function(){ 
    alert("Hello");
});

我有文本字段:

<input type="text" id="kat" value="0"/>

但它不工作。任何帮助?

解决方法

这是来自对jQuery文档页面评论

In older,pre-HTML5 browsers,“keyup” is definitely what you’re looking for.

In HTML5 there is a new event,“input”,which behaves exactly like you seem to think “change” should have behaved – in that it fires as soon as a key is pressed to enter information into a form.

$(‘element’).bind(‘input’,function);

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...