N
N
NDll2022-03-24 21:51:17
typescript
NDll, 2022-03-24 21:51:17

How to solve "Property 'style' does not exist on type 'Element'" error?

I get all elements:

const items = document.querySelectorAll('.tabItem')

With such a record

if (items[index]) items[index].style.display = 'none'

swears at

Property 'style' does not exist on type 'Element'.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2022-03-24
@NDll

document.querySelectorAll<HTMLDivElement>('.tabItem')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question