I use the onpaste event for detect the paste in input element. It works fine when we paste using ctrl + v but I use mouse to paste rightclick + paste it wont update the value. What I do wrong in here. Can anyone assist me.
$("input").on("keyup paste",function(){
$("#result").text($(this).val());
});
Jsfiddle
Thanks in advance
I use the onpaste event for detect the paste in input element. It works fine when we paste using ctrl + v but I use mouse to paste rightclick + paste it wont update the value. What I do wrong in here. Can anyone assist me.
$("input").on("keyup paste",function(){
$("#result").text($(this).val());
});
Jsfiddle
Thanks in advance
Share asked Jul 12, 2013 at 7:07 user2073289user2073289 1451 gold badge2 silver badges7 bronze badges 4- Have you tried the paste event? not keyup paste – auo Commented Jul 12, 2013 at 7:09
- keyup is for while typing in the input element. I bind the multiple event keyup and paste thats all. – user2073289 Commented Jul 12, 2013 at 7:11
-
1
@AndreasLindgren, if you have nothing to say, then don't say anything -
jQuery on(...)
accepts multiple events separated by space. – ElmoVanKielmo Commented Jul 12, 2013 at 7:13 - Thanks for letting me know that @ElmoVanKielmo, I didn't know it – auo Commented Jul 12, 2013 at 7:14
2 Answers
Reset to default 7Just try this:
$('input').bind('input propertychange', function() {
$("#result").text($(this).val());
});
And the fiddle is here http://jsfiddle/Frnc7/
You have to add a timeout...
$('input').on('paste', function () {
setTimeout(function () {
$('#result').text($('input').val());
}, 100);
});
See jsFiddle