Current location: Hot Scripts Forums » General Web Coding » JavaScript » ONKEYUP and ONCHANGE events


ONKEYUP and ONCHANGE events

Reply
  #1 (permalink)  
Old 10-27-03, 10:47 AM
770 770 is offline
New Member
 
Join Date: Oct 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ONKEYUP and ONCHANGE events

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?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 11:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.