detect paste on input box

前端 未结 4 1276
挽巷
挽巷 2020-12-14 21:34

I have inputbox. When page load, i use mouse to right click inputbox and choose paste from contextmenu.

when text get pasted, which event to use to alert text insta

4条回答
  •  轮回少年
    2020-12-14 22:09

    You can bind these events like so:

        $(document).ready(function() {
            $("#Text1").bind('copy', function(e) {
                alert('copying text!');
            });
            $("#Text1").bind('paste', function(e) {
                alert('pasting text!');
            });
            $("#Text1").bind('cut', function(e) {
                alert('cut text!');
            });
        });
    

提交回复
热议问题