2

I'm using jquery copy paste methods to do something when text is pasted into my text area

$(function(){
    $("#input").bind({
        paste : function(){    
            show_ln();
            $("#t2").scrollTop($("#input").scrollTop());    
        }
    });
});

But I want to do something else when any other keypress within #input is done.

   $("body").on("keypress", "#input", function(){
        show_ln();
    });

Is there any way to bind that second keypress to everything but a paste?

Community
  • 1
  • 1
1252748
  • 14,597
  • 32
  • 109
  • 229

1 Answers1

0

Yes you can use keyup event instead or lookup for the keyCode in keypress listener.

$("body").on("keyup", "#input", function(event){
    // For the case paste also fires this event you can have a look on keyCode.
    if(event.keyCode!=="NUMBER_OF_PASTE"){
       show_ln();
    }
});
Bernhard
  • 4,855
  • 5
  • 39
  • 70