We have triggered keypress/down/up events programmatically easily with JavaScript/jQuery.
$(function() {
$('item').keydown();
$('item').keypress();
$('item').keyup();
$('item').blur();
});
But with Angular 5 and TypeScript, how can we do that?
//I am setting value programmatically -> working
document.getElementById('custom_Credit').setAttribute('value', coinsToBuy);
//setting focus -> working
document.getElementById('custom_Credit').focus();
//but there are no way to generate or trigger keypress/up events.
document.getElementById('custom_Credit')..........;
DocumentAPIs. It's also not recommended to use jQuery for it. Angular has it's own way of doing this. Use the(click)event instead. Like this<div (click)="eventHandler()"></div>KeyUpevent, so I wanted to trigger that. I know, that I can call(click)and call that function which is called byKeyUp. Please let me know if there is a way to call it.