Alex Rivera | Logout

Paste event in JavaScript

Asked 2012-05-31T12:40:57.870
25

How can I handle the paste selected through right click in JavaScript? I tried with onpaste event and all other html events available but nothing works.

Edit
Report

1 Answer

1

I was surprised question #4532473 got closed unanswered about what happens if you want to capture the afterpaste event. As this is probably the problem half of the cases a possible approach in firefox (tested) is to register an oninput event right inside the onpaste handler and remove the oninput handler as soon as it's done executing.

In ie the onpropertychange should be used instead of oninput. (not tested)

answered 2012-07-03T07:29:03.393

Your Answer