thanks by advance for your help. It's my first little project with object and it's hard.
I create a board with Object but I would like to increment "ID" for each divElts I have create. Can you help me ?
function Plateau(width,height,id){
this.width = width +'px';
this.height = height+'px';
this.id=0;
this.creation = function(){
for (var i = 0; i < 40; i++) {
var divElts = document.createElement('div');
divElts.classList.add('case');
divElts.style.width = this.width;
divElts.style.height = this.height;
divElts.setAttribute = ('id', this.id++);
document.getElementById('contenu').appendChild(divElts);
}
};
}
var board = new Plateau(40,40);
board.creation();
#contenu{
width :440px;
height:440px;
}
.case{
border-radius:20px;
border:solid black 1px;
display:inline-block;
width:200px;
height:200px;
background-color:yellow;
}
<div id="contenu"></div>
Thanks