I have searched a lot and saw plenty of answers but none solved my problem. I am making a TamperMonkey extension for a certain website. All I want to do is to have a behavior that literally presses a key for eg. 'A' then press 'BackSpace' to delete the value again.
First of all, I want to solve the problem of pressing any letter.
I don't want to use $('.classDiv').append('A');
because it doesn't appear as if a keyboard button was pressed. So I have used all the codes in the references below even understanding the difference between codes:
- Definitive way to trigger keypress events with jQuery
- Is it possible to simulate key press events programmatically?
Maybe the following will give us a hint, the div shows multiple event handlers using FireFox:
- click
- onBeforeInput
- onBlur
- onClick
- onCompositionStart
- onCompositionEnd
- onFocus
- onInput
- onKeyDown
- onKeyPress
- onPaste
- onSelect
Note: the div serves as text input.