Borders for grid items do not function well for all sizes(sketchpad)

Hello everyone ! Hope you’re having a happy weekend
I am trying to make a border for this sketch area, the default size is 16*16, it’s working well :

But when changing the size of grid to any value between 1-100 , not all the sketch is bordered , like this : Note that I only have one input field , so entering 60 gives 60 *60

Will the solution start from changing height or width of the main grid ?

The problem is that you’re not clearing your grid first, before creating a new one, so you’d have to add one line to the top of your generateGrid function:

function generateGrid(pixles) {
  container.innerHTML = '';
1 Like