Why does VS Studio Code insert code I do not want when typing?

99 Views Asked by At

I'm puzzled as to why the suggested code that pops up with in vs studio takes over when I'm typing the following code;

x[i].style.color = 'red';

it takes over just after 'style' is typed and I hit the period button. Quite annoying.

Below is the block of code I'm running:

function myFunction() {
  let x, i;
  x = document.querySelectorAll('.para');
  for (i = 0; i < x.length; i++) {
    x[i].style.color = 'red';
  }
}

This is what happens in the editor, it wants to insert 'getElementsByClassName':

function myFunction() {
  let x, i;
  x = document.querySelectorAll('.para');
  for (i = 0; i < x.length; i++) {
    x[i].getElementsByClassName.
  }
}
0

There are 0 best solutions below