Javascript Events: Getting notified of changes in an <input> control value

前端 未结 6 953
野的像风
野的像风 2020-12-11 04:09

I have the following problem:

I have an HTML textbox () whose contents are modified by a script I cannot touch (it is my page

6条回答
  •  失恋的感觉
    2020-12-11 04:37

    addEventListener("DOMControlValueChanged" will fire when a control's value changes, even if it's by a script.

    addEventListener("input" is a direct-user-initiated filtered version of DOMControlValueChanged.

    Unfortunately, DOMControlValueChanged is only supported by Opera currently and input event support is broken in webkit. The input event also has various bugs in Firefox and Opera.

    This stuff will probably be cleared up in HTML5 pretty soon, fwiw.

    Update:

    As of 9/8/2012, DOMControlValueChanged support has been dropped from Opera (because it was removed from HTML5) and 'input' event support is much better in browsers (including less bugs) now.

提交回复
热议问题