<button onclick="funPositionGrid("1fr 1fr")">2</button>
<div id="gridContainer>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
#gridContainer{
display:grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
height: 500px;
width: 500px;
}
function funPositionGrid(num) {
document.getElementsByClassName("gridCatalog")[0].style.gridTemplateColumns = num;
}