How do I capture the input value on a paste event?

后端 未结 5 1077
清歌不尽
清歌不尽 2020-12-05 10:08

On my site users can paste text (in this case a url) into an input field. I\'d like to capture the value of the text that was pasted using jQuery. I\'ve got this to work in

5条回答
  •  半阙折子戏
    2020-12-05 11:13

    Maybe try using the onblur event instead. So the user c/p into the input and when they leave the field the script checks what's there. This could save a whole lot of hassle, since it works for mouse and key c/p as well as manually entered input.

提交回复
热议问题