A directory of browser-based WYSIWYG editors


Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
Javascript - ONKEYUP and ONCHANGE events

The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.


New User

Oct 27, 2003, 10:54 AM

Post #1 of 1 (1538 views)
Javascript - ONKEYUP and ONCHANGE events Can't Post

As a user types into a textfield, another field generates a new number to reflect each additional letter. For example, "c" yields 1, "ca" yields 3 and "cat" regenerates the number field to, say, 9. The user sees this update as he types in his string. For this we use the ONKEYUP event.

Our problem comes when the user "pastes" a string into the text field. Pasting doesn't trigger the ONKEYUP event. Were we to use ONCHANGE, we'd lose the letter-by-letter update-and-show-number feature. That's because ONCHANGE only gets the input once the entire string is entered.

Can you suggest code that incorporates the benefits of both the ONKEYUP and the ONCHANGE events, so we could still offer letter-by-letter updates and, in the event of a paste, update the number field based on the entire string?


Search for (options)