Well, I ran into a problem.
I have inside a div padre
, two elements. One is a div
let 's call it hijo_1
and the other is a ul
that would be the hijo_2
.
The problem is that I am positioned in the node hijo 2
and what I want is to add hijo_1
a class called arrow
, but I have no idea how to do it.
Any ideas?
<li class="Padre" >
<div class="hijo_1">
<a href="#" class="nav__link open" ><i class="far fa-chart-pie"></i> Estadisticas</a>
<img src="{{ URL::asset('img/main/svg-icon/arrow.svg') }}" class="list__arrow">
</div>
<ul class="hijo_2">
<li class="list__inside">
<a href="#" class="nav__link nav__link--inside">Estoy dentro</a>
</li>
<li class="list__inside">
<a href="#" class="nav__link nav__link--inside">Estoy dentro</a>
</li>
</ul>
</li>
If you are positioned on the
hijo_2
, to access thehijo_1
adjacent one simplypreviousElementSibling
. Check more details here .