3

I am looking for a way to trigger the delete key on jQuery. However, for example, the whole selection (Ctrl+A) works well, The Delete key does not work.

Below is a part of my code:

var ctrlA = $.Event( "keydown", { keyCode: 65, ctrlKey:true } ),
    e = $.Event( "keydown", { keyCode: 46 } );

....
$( editor.getBody() ).trigger( ctrlA );
$( editor.getBody() ).trigger( e );

This will make the entire selection but it will not be deleted.

How to trigger the Delete key in jQuery?

user7637745
  • 965
  • 2
  • 14
  • 27
SH.Ko
  • 31
  • 2
  • Possible duplicate of [Capturing "Delete" Keypress with jQuery](http://stackoverflow.com/questions/1116244/capturing-delete-keypress-with-jquery) – Riya Jan 25 '17 at 02:48
  • 2
    @Riya OP wants to cause it, not capture it. – ceejayoz Jan 25 '17 at 02:50

0 Answers0