admin管理员组文章数量:1332388
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
本文标签: javascriptonPaste event on jquery not update while using mouseStack Overflow
版权声明:本文标题:javascript - onPaste event on jquery not update while using mouse - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742290369a2447685.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论