depending on which container I click, I would like to add a class to the equal box. So if I click on the first container -> add class to first box.
In my script I have to write it for each container and duplicate it.. - but I guess there is a way to make it easier? At the end there will be around 100 entries
This HTML:
<div id="row">
<div class="container">
<div class="info">A</div>
</div>
<div class="container">
<div class="info">B</div>
</div>
<div class="container">
<div class="info">C</div>
</div>
<div class="container">
<div class="info">D</div>
</div>
</div>
<div id="row-second">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
</div>
This Script:
$("#row .container:nth-child(1) div.info").on("click", function() {
$("#row-second div.box:nth-child(1)").addClass("show");
});
$("#row .container:nth-child(2) div.info").on("click", function() {
$("#row-second div.box:nth-child(2)").addClass("show");
});
....