jquery keyup detect paste text from input

后端 未结 2 601
遇见更好的自我
遇见更好的自我 2021-01-01 17:12

I have to use here jquery keyup to detect if user enter any text or not, but my problem is if user use paste the text using mouse, it won\'t be able to dete

2条回答
  •  不知归路
    2021-01-01 17:41

    Apparently there are some situations where jQuery doesn't work for pasting. You might need to bind to several events as shown in following reference to catch users pasting contents accurately.

    From Soliciting Fame - jQuery keyup vs bind - (from way-back machine)

    // detect the change
    $('input#myId').bind("change keyup input",function() { 
        // handle events here
    });
    

提交回复
热议问题