adsense

Wednesday, May 1, 2019

jQuery working with paste

Following jQuery code can be used to catch the paste on an input and do some manupulation to the data pasted.

<script type="javascript">
   function pageLoad(){ //or you can use DOM Ready
 
       $('textarea').bind('paste', function () {
               var this= $(this);
                var orig = self.val();

                setTimeout(function () {//to chech the diffetence between pasted and original text
                   
                    if(this[0].value!==orig  ){
                        //more code
                    }
               });


});

  }
</script>

Cheers,
Samitha

No comments:

Post a Comment