How to change the value of items in a ul?

There is a list :
<ul class="ul-list" <li>
<a>Text</a>

 <li class="li-list">
<a>Text</a>
</li>
 <li class="li-list">
<a>Text</a>
</li>
</ul>

This code is generated when the page is loaded. There is an array that contains strings . How to use javascript in each element "li" replace value of element "a"
June 14th 19 at 20:53
1 answer
June 14th 19 at 20:55
Solution
so:
var arr = ["one","two","three", "fore"];
var foo = document.querySelectorAll('.ul-list a');
 for (var i = 0; i <= foo.length - 1; i++) {
 foo[i].innerHTML = arr.shift();
 }
thank you, the script started after the assignment window.onload. - Margaretta commented on June 14th 19 at 20:58
Yes - Garfiel commented on June 14th 19 at 21:01

Find more questions by tags JavaScriptjQuery