I'm trying to loop over a bunch of buttons to give each of them an event listener that will change the background color once I click any of them, but vs code's IntelliSense won't autocomplete the desired property I'm looking for such .style .
const buttons = document.querySelectorAll('btn');
for(let button of buttons) {
button.addEventListener('click', () => {
button.*style.backgroundColor* = 'red';
})
}
HTML
<body>
<section id="container">
<button class="btn">Click me</button>
<button class="btn">Click me</button>
<button class="btn">Click me</button>
<button class="btn">Click me</button>
</section>
<script src="app.js"></script>
</body>
VS Code intellisense won't recommend the italicized code .style and .backgroundColor
it's happening of both block and scope level as will as global level.