9

I'm able to detect the cut, copy, paste events with the following code

$('#searchInput').bind('cut copy paste', function (e) {
  setTimeout("handleMouseEvents();", 10);
});

Is it possible to detect the following events

  1. delete input box text with mouse
  2. drag text to input box
  3. drag text away from input box
  4. undo action from mouse context menu or form 'Edit' menu

I tried binding on mousedown and mouseup, but not working

$('#searchInput').bind('cut copy paste mousedown mouseup', function (e) {
  setTimeout("handleMouseEvents();", 10);
});

1 Answer 1

2

I was able to get binding to work for these events cut copy paste mousedown mouseup focus blur

which should cover you on delete, drag out, drag in circumstances but you won't necessarily know that much detail just that the field has changed and which bound event caused the change, I think you'd also have to keep tabs on the current/previous value of the input field between events.

Here's the jsfiddle I was playing with http://jsfiddle.net/9aRxb/1/

Sign up to request clarification or add additional context in comments.

3 Comments

Have you checked the demo in Firefox? it is not working in Firefox 3.6.15, but works in IE and Chrome
looks like you can bind to several drag/drop events Clipboard Operations for the Web 1.0: Copy, Paste, Drag and Drop. I tested firefox on some of these drop dragleave etc all were working as expected
doesn't work with delete AFAICS. (Right click on selected text and select Delete from the menu.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.