简体   繁体   English

当隐藏的输入框的文本由外部jquery更改时,如何触发函数?

[英]How can I trigger a function when the text of a hidden input box changes by an external jquery?

The user will not be directly changing the input box, so keyup/keypress is not useful. 用户将不会直接更改输入框,因此键盘输入/键盘输入无用。 Since onchange is triggered when the input box loses focus, I cannot use change() or onchange() . 由于当输入框失去焦点时会触发onchange,因此我不能使用change()onchange() The external jquery is modifying the input, so I cannot use trigger() . 外部jquery正在修改输入,因此我不能使用trigger() Is there any other method to do this without using setInterval ? 是否有其他方法可以不使用setInterval来执行此操作?

As far as i know, there's a DOM LEVEL EVENT that fires when anything changes, but it's not supported by all browsers, in fact, i think only Chrome and FireFox does. 据我所知,有一个DOM LEVEL EVENT在任何更改时都会触发,但是并非所有浏览器都支持,事实上,我认为只有Chrome和FireFox可以。

Here's a link to a solution for this: Detect changes in the DOM 这是解决方案的链接: 检测DOM中的更改

hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM