Detect all changes to a <input type="text"> (immediately) using JQuery

Posted by Dustin Boswell on Stack Overflow See other posts from Stack Overflow or by Dustin Boswell
Published on 2009-12-22T18:40:08Z Indexed on 2010/06/11 8:22 UTC
Read the original article Hit count: 171

Filed under:
|
|

There are many ways the value of a <input type="text"> can change, including:

  • keypresses
  • copy/paste
  • modified with JavaScript
  • auto-completed by browser or a toolbar

I want my JavaScript function to be called (with the current input value) any time it changes. And I want it to be called right away, not just when the input loses focus.

I'm looking for the cleanest and most robust way to do this across all browsers (using jQuery preferably).

Example use case: On the Twitter Signup page, the username field's value gets shown in the url "http://twitter/username" below it.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery