Today, I want automatic type the text to textarea
I don't want to change the value of textarea
$("textarea").text("abc")
The thing I want is simulate a keypress event like human. You can see this picture https://i.stack.imgur.com/edD9k.png
I tried trigger some keyboard events, but It doesn't work
var get_event = function(method, keycode){
e = $.Event(method);
if(keycode){
e.which = keycode;
}
return e;
}
$('#test').focus();
$('#test').trigger(get_event("keydown", 65));
$('#test').trigger(get_event("keypress", 65));
$('#test').trigger(get_event("keyup"));
$('#test').trigger(get_event("blur"));