Why is Event.target not Element in Typescript?

后端 未结 8 873
情歌与酒
情歌与酒 2020-12-01 03:55

I simply want to do this with my KeyboardEvent

var tag = evt.target.tagName.toLowerCase();

While Event.target is of type EventTarget it doe

8条回答
  •  难免孤独
    2020-12-01 04:46

    @Bangonkali provide the right answer, but this syntax seems more readable and just nicer to me:

    eventChange($event: KeyboardEvent): void {
        ($event.target).value;
    }
    

提交回复
热议问题