Search code examples
javascripthtmlcsstypescript

TypeScript set css style for HTMLCollectionOf<Element>, NodeCollection<Element>,google autocomplete forms


how can I set css style for the HTMLCollectionOf or the NodeCollection?

 let items = document.querySelectorAll('.pac-item') as NodeListOf<HTMLElement>;

enter image description here

For HTMLElement set style working good enter image description here


Solution

  • Thank's guys! My fail...that was collection of elements...resolved it by itteration

     var items:any = document.getElementsByClassName('pac-item');
            for (let i = 0; i < items.length; i++) {
                let element = items[i];
                element.style.background = '#2B2B2B';
                element.style.color = '#DEDEDE';
            }