Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  168] [ 5]  / answers: 1 / hits: 20530  / 12 Years ago, mon, august 27, 2012, 12:00:00

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.


More From » jquery

 Answers
20

Kind of a hack, but:



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

[#83397] Sunday, August 26, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yvettel

Total Points: 517
Total Questions: 101
Total Answers: 102

Location: Vanuatu
Member since Wed, Oct 14, 2020
4 Years ago
yvettel questions
Tue, Jul 27, 21, 00:00, 3 Years ago
Thu, Aug 13, 20, 00:00, 4 Years ago
Wed, Apr 15, 20, 00:00, 4 Years ago
Wed, Apr 1, 20, 00:00, 4 Years ago
;