I want to assign some value where the class name is "grid-filter" but it's giving a compilation error in the angular typescript.
code
document.getElementByClassName('grid-filter')[0].title='new title';
CodePudding user response:
You need to cast the element returned to an array of HTMLElement
since you're selecting by class name:
(document.getElementByClassName('grid-filter') as HTMLElement[])[0].title = 'new title';