I am using the setTimeout function to set the focus on a button element of a bootstrap modal. The following is the small piece of code which I wrote:
let element = this.el.nativeElement;
setTimeout(() => element.focus(), 200);
This works correctly on Firefox and Chrome. But on IE 11, I get the focus on the button for a blink of a second and it looses focus.
Do I have to do anything different in the case of IE 11 here? Am I doing something wrong?
Any help would be really appreciated.
Thank you.
Cheers.
IE11 doesn't support arrow functions. You will need to pass a function reference instead:
setTimeout(function (){ element.focus(); }, 200);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With