Invoke a function after right click paste in jQuery

javascript, jquery

Solution

Kind of a hack, but:

$("#id").bind('paste', function(e) {
        var ctl = $(this);
        setTimeout(function() {
            //Do whatever you want to $(ctl) here....
        }, 100);
});

Problem

I know we can use bind paste event as below: ``` $('#id').bind('paste', function(e) { alert('pasting!') }); ``` But the problem is, that it will call before the pasted text paste. I want a function to be triggered after the right click -> paste text pasted on the input field, so that I can access the pasted value inside the event handler function. `.change()` event also doesn't help. Currently I use `.keyup()` event, because I need to show the remaining characters count while typing in that input field.

Original source

Related problems