Is it possible to get pasted text without using the setTimeout() function?

前端 未结 4 1699
-上瘾入骨i
-上瘾入骨i 2021-01-02 15:47

I found out that when pasting text (i.e. Hello) by using the mouse, the following function will throw an empty popup:

$(\'input:text\').onpaste          


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 16:20

    $('input:text').bind('paste', function() { 
        alert($(this).val());
    });
    

提交回复
热议问题