Is there a way to easily delete multiple HTML elements by selecting them and pressing the Backspace
key? This functionality is available in the WordPress block editor as well as Editor.js. Users can highlight several blocks
and remove them with a simple keystroke.
To achieve this, one would need to select (not click) the .block-1, .block-2, .block-3
sections and then press the Backspace
key to delete them.
[IMPORTANT]
- Make sure each block has the contenteditable attribute.
- For a demonstration of what I am looking for, please visit Editor.js.
<div class="block-1" contenteditable="true"> 1st Block </div>
<div class="block-2" contenteditable="true"> 2nd Block </div>
<div class="block-3" contenteditable="true"> 3rd Block </div>
<div class="block-4" contenteditable="true"> 4th Block </div>