Detect backspace and del on "input" event?
<p>How to do that?</p>

<p>I tried:</p>

<pre><code>var key = event.which || event.keyCode || event.charCode;

if(key == 8) alert('backspace');
</code></pre>

<p>but it doesn't work...</p>

<p>If I do the same on the keypress event it works, but I don't want to use keypress because it outputs the typed character in my input field. I need to be able to control that</p>

<hr>

<p>my code:</p>

<pre><code>  $('#content').bind('input', function(event){

    var text = $(this).val(),
        key = event.which || event.keyCode || event.charCode;

    if(key == 8){
      // here I want to ignore backspace and del
    }

    // here I'm doing my stuff
    var new_text = 'bla bla'+text;
    $(this).val(new_text);
  });
</code></pre>

<p>no character should be appended in my input, besides what I'm adding with val()
actually the input from the user should be completely ignored, only the key pressing action is important to me</p>
