Catching all changes to the contents of an input box using Javascript/jQuery

后端 未结 3 1754
名媛妹妹
名媛妹妹 2021-01-13 20:37

I have a page with an input box, and a function that processes the value of this input box and produces piece of text. I want this text to always be up to date in relation t

相关标签:
3条回答
  • 2021-01-13 21:15

    In non-IE browsers, you can handle the input event.
    In IE, you can handle the propertychange event.

    Demo (works in all browsers)

    0 讨论(0)
  • 2021-01-13 21:15

    If you can't find a combination of events that cover all cases, you may want to use setInterval(function() {... }, period). You could play around with the period to see how well this works.

    0 讨论(0)
  • 2021-01-13 21:34

    It's possible this SO question (and related jsfiddle) might answer your question.

    (On the linked jsfiddle, put text in the top box to test)

    In other words, bind to mouseup and mousedown, etc.

    0 讨论(0)
提交回复
热议问题