'How do i swap the old links in my a links href attribute values with the ones in my newLink array?
I've been trying to get my a links to get the attribute value from my newLink array as it new attribute value to no avail. Any help would be welcome.
<ul id="ul">
<li><a href="https://www.google.com/">GOOGLE</a></li
<li><a href="https://www.amazon.com/">AMAZON</a></li>
<li><a href="https://www.ebay.com/">EBAY</a></li>
<li><a href="https://www.pointekonline.com/">POINTEK</a></li>
</ul>
ul.onclick = function (e) {
let newLink =["https://www.barcablaugranes.com/","https://managingmadrid.com/","https://bavariafootballwork.com/","https://wagnh.com/"]
let ass = querySelectorAll('a');
if (e.target.nodeName != 'A') return;
for(let i = 0; i < ass.length; i++){
return ass[i].href = links[i]
}
return false;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
