CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
4.27k
stars
487
forks
source link
TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. #295
Closed
krishna-kapoor closed 4 years ago
I'm using React.js and this is the error I get. Here is my code:
toggleDiv(id) { const elem = document.getElementById(id); const display = window.getComputedStyle(elem).getPropertyValue('display'); if (display === 'none') { elem.style.display = 'block'; return false; } else { elem.style.display = 'none'; return true; } }
Please tell me how the variable
elem
is not an element.