Answers for "property 'style' does not exist on type 'nodelistof element '"

1

Property 'style' does not exist on type 'Element'.ts(2339)

// Cast to the type of `HTMLElement`
const el = document.getElementById('whatever') as HTMLElement;
el.style.paddingTop = ...;

// Or, if it is an array
const els = document.getElementsByClassName('my-class') as HTMLCollectionOf<HTMLElement>;
Posted by: Guest on August-09-2021

Code answers related to "property 'style' does not exist on type 'nodelistof element '"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language