gpt4 book ai didi

jQuery - 更改输入文本

转载 作者:行者123 更新时间:2023-12-03 21:34:31 26 4
gpt4 key购买 nike

我正在尝试创建一个在文本输入字段的值更改时执行的函数。当单击表格单元格时,字段的值会发生变化,而不是在 keyup 上或粘贴时发生变化。我尝试过这样的:

$("#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);

关于jQuery - 更改输入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10438369/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com