As for the question which event you should use for this: use the event, and fall back to / in older browsers.
Here’s an example, DOM0-style:
The other question is how to count the number of characters in the string. Depending on your definition of “character”, all answers posted so far are incorrect. The answer is only reliable when you’re certain that only BMP Unicode symbols will be entered. For example, , as you’d expect.
P.S. I just noticed the counter script that Stack Overflow uses gets this wrong. Try entering , and you’ll see that it (incorrectly) counts as two characters.
- Is there a similar theme for WordPress
- Is Provo Utah safe
- What is The Intruders most successful song
- How long do lip injections last
- Can anyone identify this autograph
- Why are bodycon dresses so popular
- Why are you interested in sales
- What are the principles of counseling
- How common is Israeli on Israeli crime
- What is magnetic equator
- Has a time machine been invented
- Where did hurricane Katrina hit
- Is Olympic curling underrated
- Why do people like bastinado
- How does ABS work in a vehicle