jQuery event detection - delete input box text with mouse, drag text to input box

前端 未结 1 1472
时光说笑
时光说笑 2021-02-15 00:08

I\'m able to detect the cut, copy, paste events with the following code

$(\'#searchInput\').bind(\'cut copy paste\', function (e) {
  setTimeout(\"         


        
1条回答
  •  孤街浪徒
    2021-02-15 00:40

    I was able to get binding to work for these events cut copy paste mousedown mouseup focus blur

    which should cover you on delete, drag out, drag in circumstances but you won't necessarily know that much detail just that the field has changed and which bound event caused the change, I think you'd also have to keep tabs on the current/previous value of the input field between events.

    Here's the jsfiddle I was playing with http://jsfiddle.net/9aRxb/1/

    0 讨论(0)
提交回复
热议问题