I want to change some attributes within the fields: ul > li . In the case I will change the a.url and img.src, however I am using a for for changing the fields it is using in the artistSimimarChild [i] mode how can I access the ul > li > a and ul > li > a > img?
HTML:
<ul class="ui-artist-related">
<li class="ui-artist-related__column ui-artist-related__artist"><a href="#"><img src="assets/images/profiles/katyperry.jpg" /></a></li>
<li class="ui-artist-related__column ui-artist-related__artist"><a href="#"><img src="assets/images/profiles/kesha.jpg" /></a></li>
<li class="ui-artist-related__column ui-artist-related__artist"><a href="#"><img src="assets/images/profiles/arianagrande.jpg" /></a></li>
</ul>
Javascript:
const artistSimilar = document.querySelector(".ui-artist-related"),
artistSimimarChild = document.querySelectorAll("li.ui-artist-related__artist");
The way I thought next would be to do:
var 1 = document.querySelectorAll("li.ui-artist-related__artist > a")[i];
var 2 = document.querySelectorAll("li.ui-artist-related__artist > a > img")[i];
But I do not want to be creating several var to select a specific field and in the end it will be a mess my code.