I recently managed 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:
Collapse3(Step3)openonly
When I click on Step 2 or Step 3, the two arrows (which are images) switch together, I need to do this in another 12 steps, but they have to switch independently, how can I do it? >
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 code:
<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);
}
});