0
Recently I was able to solve a problem of putting an image and when I clicked on it, it became another, and when I went to pass the code to the other collapses, it happened to me:
When I click on Step 2 or Step 3, the two arrows (which are images) exchange together, I need to do this in 12 more Teps, only they have to change independently, as I can do?
Step 2 code:
<h1 class="collapsed change"
data-toggle="collapse"
data-parent="#accordion"
href="#collapseTwo"
aria-expanded="false"
aria-controls="collapseTwo"
ng-click="alert_step2()">
<img class="change img-change" src="assets/img/arrow_right.png" style="width: 20px; height: 25px">Step 2 - Acknowledge Your Strengths (highest scores)
</h1>
Step 3:
<h1 class="collapsed change"
data-toggle="collapse"
data-parent="#accordion"
href="#collapseThree"
aria-expanded="false"
aria-controls="collapseThree"
ng-click="alert_step3()">
<img class="change img-change" src="assets/img/arrow_right.png" style="width: 20px; height: 25px">Step 3 - Consider The Areas of Your Life that Need Support (lowest scores)
</h1>
Javascript code:
$('.change').click((e) => {
var img1 = 'assets/img/arrow_right.png';
var img2 = 'assets/img/arrow_down.png';
var element = $('.img-change');
if(element.attr('src') === img1)
{
element.attr('src',img2);
}
else if(element.attr('src') === img2)
{
element.attr('src',img1);
}
});
Put your code, only with the image does not help you. But probably your two elements have the same ID="" wo of the same stick
– hugocsl
posted! had forgotten
– EduardoBacarin
I will post the answer with the corrected code!
– Mateus Veloso