使用jquery/javascript检测文本输入框中的更改 [英] detecting change in a text input box using jquery/javascript

查看:90
本文介绍了使用jquery/javascript检测文本输入框中的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在html和javascript中,我可以使用键控,聚焦,模糊来检测文本输入中的大部分内容更改,但是,如果用户执行复制并粘贴到文本输入中,如何捕获此更改?这里的问题是,当用户粘贴到输入中时,输入已经成为焦点.

in html and javascript, I can use keyup, focus, blur to detect most of the content changes in a text input, however if the user do a copy and paste into the text input, how do I capture this change? The issue here is that the input is already in focus when user paste into it.

推荐答案

您可以捕获粘贴事件(

You could capture the paste event (http://www.quirksmode.org/dom/events/cutcopypaste.html)

$("#myinput").bind("paste",function(){
    //code here
})

这篇关于使用jquery/javascript检测文本输入框中的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆