I would like to simulate that there was pressed backspace key on keyboard after i click on button but all my attempts have failed. Here is my code:
function rtf(){
document.getElementById("u0u").focus();
$('#u0u').trigger(jQuery.Event('keypress', { keycode: 8 }));
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id='u0u'>
<div onclick='rtf()' style='cursor:pointer'><span>Backspace</span></div>