I simply want to do this with my KeyboardEvent
var tag = evt.target.tagName.toLowerCase();
While Event.target
is of type EventTarget
, it does not inherit from Element
. So I have to cast it like this:
var tag = (<Element>evt.target).tagName.toLowerCase();
This is probably due to some browsers not following standards, right? What is the correct browser-agnostic implementation in TypeScript?
P.S. I am using jQuery to capture the KeyboardEvent
.
var element = ev.target as HTMLElement
– Adrian Moisa