0
How to select test8 from the post I clicked??
var black = document.querySelectorAll(".test4");
for(var i = 0; i < black.length; i++){
black[i].addEventListener("click", selectRoxo);
}
function selectRoxo(){
// Como selecionar test8 do post que cliquei??
}
.posts{
width: 180px;
height: 180px;
margin-bottom: 5px;
}
.coluna1, .coluna2{
width: 90px;
height: 50%;
background: red;
}
.la, .lo{
height: 25%;
width: 100%;
background: green;
}
.test4{
background: black;
color: white;
cursor: pointer;
}
.test8{
background: purple;
color: white;
}
<div class="posts">
<div class="coluna1">
<div class="test1 la"></div>
<div class="test2 la"></div>
<div class="test3 la"></div>
<div class="test4 la">Clicar</div>
</div>
<div class="coluna2">
<div class="test5 lo"></div>
<div class="test6 lo"></div>
<div class="test7 lo"></div>
<div class="test8 lo">8</div>
</div>
</div>
<div class="posts">
<div class="coluna1">
<div class="test1 la"></div>
<div class="test2 la"></div>
<div class="test3 la"></div>
<div class="test4 la">Clicar</div>
</div>
<div class="coluna2">
<div class="test5 lo"></div>
<div class="test6 lo"></div>
<div class="test7 lo"></div>
<div class="test8 lo">9</div>
</div>
</div>
vlw, you helped me!
– AKU
Do not worry. Do not forget to mark in the answer you thought best. I saw here that you never mark rs... this is not interesting for the community. Always try to choose an answer to your questions and mark on only one of them. Abs!
– Sam
Uai I mark arrow up, has another place to qualify?
– AKU
Below the arrow has a gray symbol
– Sam
When you click on it it turns green, but you should only do this in only 1 answer, the one you thought best... vote (arrows) you can vote for as many as you want
– Sam
You are not required to mark when no response has resolved or helped in any way, but this is usually rare
– Sam
This is explained on the page of Tour... it’s good to take a look
– Sam
Thanks! Then review all your questions and mark the best answer of each one... they are all unanswered chosen. Abs friend!
– Sam