I'm trying to reach a parent of some element:
let t = e.target.parentNode
but i have this Error: Property 'parentNode' does not exist on type 'EventTarget'
I've tried with <Element>e.target.parentNode
but this also not gives me any results. Can anybody help?
I had to wrap the typecasting in parentheses:
let parent = ( <HTMLElement>event.target ).parentElement;
or using parentNode:
let parent = ( <HTMLElement>( <HTMLElement>event.target ).parentNode );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.