This commit is contained in:
Rup Chitrak 2018-06-11 15:45:38 +05:30
parent 4fb2d6f017
commit 00629d2aef
2 changed files with 51 additions and 1 deletions

View File

@ -1 +1,22 @@
document.body.innerHTML = "Hello world!"; // document.body.innerHTML = "Hello world!";
let main = document.createElement('div');
main.className = 'divContainer';
document.body.appendChild(main);
for(let i=0;i<2;i++) {
const rowDiv=document.createElement('div');
rowDiv.className = 'rowDivContainer'+i
main.appendChild(rowDiv);
for(let j=0;j<2;j++) {
const div=document.createElement('div');
//div.innerHTML = 'red';
div.className='divElem';
div.addEventListener("click",(e)=>{
e.target.className='colorChange';
console.log('e------->',e.target.innerHTML);
});
rowDiv.appendChild(div);
}
}

View File

@ -0,0 +1,29 @@
.divContainer{
display: flex;
flex-direction: column;
}
.rowDivContainer0{
display: flex;
border: 1px solid green;
width: 50px;
justify-content: space-around;
}
.rowDivContainer1{
display: flex;
border: 1px solid green;
width: 50px;
justify-content: space-around;
}
.divElem{
height: 30px;
width: 30px;
/*border: solid green;*/
}
.colorChange{
background-color: red;
height: 30px;
width: 30px;
}