• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Event when text is pasted into text-input, using mouse

 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a text field: <input type='text'> .
I need to run some response javascript, whenever user types into this field (for the sake of discussion, consider something like the 'auto complete' classic).

This works fine if user is typing by keyboard (I just catch 'onKeyUp' events).
However, I can't manage to get events when user is *pasting* text, using *mouse only* (without touching the keyboard).

Up till now, I tried the following, and failed:

1) onMouseUp: doesn't always work (apparently because the mouse is not within the area of the text field - instead, it's on the 'Paste' option of the 'Context Menu' popup ).

2) onContextMenu: doesn't help, because the event happens *before* the new text is pasted into the field, so I don't yet know what the new text is.

3) onChange: useless of course, because event doesn't happen immediately, but rather waits for the field to loose focus.


Is there any way out there, to get those 'mouse paste' events?
Thanks very much.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try onpaste, but it is not a standards event handler.

Eric
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic