Search code examples
javascriptnode.jsjavascript-objectssetpropertyactionlistener

Uncaught TypeError: gridElement.style.setProerty is not a function


I'm trying to set the style properties but I'm facing the following JS Error Uncaught TypeError: gridElement.style.setProerty is not a function

const CELL_GAP = 2;
const CELL_SIZE = 20;
const GRID_SIZE = 4;

export default class Grid {
  constructor(gridElement) {
    gridElement.style.setProerty("--grid-size", GRID_SIZE);
    gridElement.style.setProerty("--cell-gap", `${CELL_GAP}vmin`);
    gridElement.style.setProerty("--cell-size", `${CELL_SIZE}vmin`);
  }
}

Solution

  • Looks like you have a typo. Change setProerty to setProperty and you should be good to go.