jquery - Javascript event on keypress, but after the character has been entered -


Then I'm counting the characters on a text field. I do not need to update the character count on keypress (no keyboard) The issue is that with jquery's .keydown () method, this character refreshes the counter before it is entered, Therefore the counter is always 1 keypress behind the actual calculation. How can I get a count to change keypress, but can I wait for that character's entry?

Thank you!

setTimeout works here:

  $ ('input'). KeyDown (function (e) {var $ this = $ (this); settimeout (function () {var text = $ this.val (); console.log (text.length);}, 0);});    

Comments